How to set view size to match device screen in iOS?
I have a UIView that I need to resize to half the height of the screen, it works fine in Portrait mode but if I lunch the app with the iPad in landscape the UIView always get the screen portra开发者_StackOverflow中文版it size, any ideas how to get the size at launch and after change in orientation?
I try the following but always get protrait where width = 768 and height = 1024
NSLog( @"bounds: %@", NSStringFromCGRect( [UIScreen mainScreen].bounds ) );
NSLog( @"frame: %@", NSStringFromCGRect( [UIScreen mainScreen].applicationFrame ) );
Try to set property autoresizingMask of your view to UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleBottomMargin.
Or try to place with its value. After setting this value your view will automatically resize after device rotation.
加载中,请稍侯......
精彩评论