How to get and set iphone screen sizes and View sizes dynamically.. Suppose i'm setting imageview for an iphone, it should also fits to the ipad screen..
To get the screen size, you can use
CGSize screenSize = [[UIScreen mainScreen] bounds].size;
to get the size of your view, for example
UIViewController* myViewController = [[UIViewController alloc] init];
what you can do is similar to the one above
CGSize viewSize = myViewController.view.frame.size;
To set
myViewController.view.frame = CGRectMake(x, y, width, height);
to set use
view.frame = CGRectMake(x, y, width, height);
and to get
CGRect rect = view.frame;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With