I am looking at at view that covers the entire iPhone screen. The app is also
required to only work in Landscape. I see that in viewWillAppear the bounds and
center of the view are in Portrait mode - this is fine. However, in
viewDidAppear the bounds of the view are in Landscape, but the center is
unchanged. This makes the center of the view incorrect, which make
transformations wrong and any calculations based on the center of the view
wrong.
Should the app force a new center on an orientation change?
Further I find that running this code:
- (void)viewDidAppear:(BOOL)animated
{
[self.view setFrame: CGRectMake(0, 0, self.view.bounds.size.width,
self.view.bounds.size.height)];
[self.view setBounds:storeView.frame];
NSLog(@"viewDidAppear");
NSLog(@"self.view.bounds: %@", [NSValue valueWithCGRect:self.view.bounds]);
NSLog(@"self.view.frame: %@", [NSValue valueWithCGRect:self.view.frame]);
NSLog(@"self.view.center: %@", [NSValue valueWithCGPoint:self.view.center]);
}
generates these logs:
viewWillAppear
self.view.bounds: NSRect: {{0, 0}, {320, 568}}
self.view.frame: NSRect: {{0, 0}, {320, 568}}
self.view.center: NSPoint: {160, 284}
viewDidAppear
self.view.bounds: NSRect: {{0, 0}, {568, 320}}
self.view.frame: NSRect: {{124, -124}, {320, 568}}
self.view.center: NSPoint: {284, 160}
Where does the {124, -124} come from?
Rich Collyer
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]