0

I have just run template from Xcode (Master-Detail Application for iPhone). I only added

NSLog(@"%@", NSStringFromCGRect(self.view.bounds));

in DetailViewController:viewdidLoad

and when I rotated the screen (on Simulator) on MasterViewController to Landscape next I pushed a DetailViewController, in console I've seen:

   {{0, 0}, {320, 460}}

which is not correct because, view is in Landscape.

Any idea why?

4

2 回答 2

1

Your view's bounds is portrait by default.

If you launch your application in landscape mode, a rotation message is sent to view controller before it appears. so try to print in viewDidAppear.

于 2012-06-01T05:58:19.900 回答
0

Did you add into you detail view: - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; }

If yes, then you should print those values in viewWillAppear because maybe the screen is loaded in portrait by default then it is rotated right after loaded.

于 2012-06-01T05:58:12.760 回答