ios - Supported Orientations -


i saw in post. need override first method ios5 , following 2 ios6.

ios 5:

// override allow orientations other default portrait orientation. - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation { // return yes supported orientations return (interfaceorientation == uiinterfaceorientationlandscaperight); } 

ios 6

- (bool) shouldautorotate {       return yes; } -(nsuinteger)supportedinterfaceorientations {       return uiinterfaceorientationmasklandscaperight; } 

but, have questions how use them properly.

  1. let's set supportedorientations in settings of xcode project, have implement shouldautorotate , supportedinterfaceorientations? happens if don't?
  2. if don't override shouldautorotate, default value yes?
  3. if return no in shouldautorotatetointerface, warning "shouldautorotatetointerfaceorientation: interface orientations. should support @ least 1 orientation." bad? have implication in app?
  4. when crash "supported orientations has no common orientation application, , shouldautorotate returning yes;"
  5. what happen if return no in shouldautorotate , have multiple supprotedinterfaceorientations? same using portrait because vc won't rotation?
  6. what if return yes in shouldautorotate, have multiple supported orientation in xcode settings override supportedinterfaceorientations , return 1?

i'm doing vast majority of these answer memory there might errors...

  1. those values entered used view controllers. have override them if wanted specify different behavior in 1 view controller.
  2. yes. tested in new project with:

    // should autorotate not implemented -(void)viewdidload {      [super viewdidload];      nslog(@"%@", [self shouldautorotate]?@"y":@"n"); } 
  3. you warning because saying should not autorotate giving him more 1 supported interface orientations shouldautorotatetointerfaceorientation:. either support orientations , give possible ones or don't.
  4. if tell application (in .xcodeproj) support, example, portrait , specify in view controller supported interface orientation not include portrait up.
  5. you telling system not auto rotate. should doing rotation manually. it's possible status bar rotate interface won't.
  6. that screen in interface orientation, won't rotate. interfaces specify in xcodeproj ones can supported across app. can have specific view controllers support 1 or many of orientations.

that said, it's difficult exact desired behavior. usual approach 'trial & error'. or 1 of teachers said 'error & trial' because making error approach =)


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -