简体   繁体   中英

Start app in landscape mode only and lock the application in landscape mode

I am a new bie to stack over flow and iphone development ,I need to start my app in landscape mode only.for that i have set the keys in info.plist and write under the orientation delegete..but result remains same.I have done a tremendous research for that .but not yet successful..my xcode version is 3.2.26 and my basic template is tabbar based..Thank you so much if you are having some sincere suggestions regarding my problem

thank you

Priya (India)

You need to do this

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

return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight);

}

First of all define in your Info.plist file following key-value pair:

UIInterfaceOrientation UIInterfaceOrientationLandscapeLeft

or UIInterfaceOrientationLandscapeRight or to define initial start in Landscape right orientation afterward define shouldAutorotateToInterfaceOrientation in all your controllers in following way:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM