开发者

UIView always loads in portrait mode

开发者 https://www.devze.com 2023-03-25 21:37 出处:网络
This one has me ripping my hair out.My iPad application is setup as follows: In my app delegate I have this:

This one has me ripping my hair out. My iPad application is setup as follows:

In my app delegate I have this:

[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];

in my info.plist I have:

Initial Interface Orientation = UIInterfaceOrientationLandscapeLeft

In my first view controller that is loaded from the app delegate I have:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
    // Return YES for supported orientations.
    return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

In my second view controller I have:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
    // Return YES for supported orientations.
    return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

Finally the views in both nibs are set to landscape in Interface Builder. The application starts in landscape mode and there is a button that when pressed开发者_Go百科 assigns the second view to the first view:

self.view = secondView.view;

the problem is that even though everything is in landscape the new view is always loaded in portrait mode? Please any help on this would be very very appreciated!


This is the bit you want to change. This is what sets the allowed initial orientations. Change it to suit your needs.

It's in the summary tab of the Target's settings.

UIView always loads in portrait mode

Or. if you aren't using Xcode 4 yet - you can set the orientations in the Info.plist:

UIView always loads in portrait mode

And so you can see all the keys:

UIView always loads in portrait mode

0

精彩评论

暂无评论...
验证码 换一张
取 消