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.
- let's set supportedorientations in settings of xcode project, have implement shouldautorotate , supportedinterfaceorientations? happens if don't?
- if don't override shouldautorotate, default value yes?
- if return no in shouldautorotatetointerface, warning "shouldautorotatetointerfaceorientation: interface orientations. should support @ least 1 orientation." bad? have implication in app?
- when crash "supported orientations has no common orientation application, , shouldautorotate returning yes;"
- what happen if return no in shouldautorotate , have multiple supprotedinterfaceorientations? same using portrait because vc won't rotation?
- 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...
- those values entered used view controllers. have override them if wanted specify different behavior in 1 view controller.
yes. tested in new project with:
// should autorotate not implemented -(void)viewdidload { [super viewdidload]; nslog(@"%@", [self shouldautorotate]?@"y":@"n"); }- you warning because saying should not autorotate giving him more 1 supported interface orientations
shouldautorotatetointerfaceorientation:. either support orientations , give possible ones or don't. - if tell application (in .xcodeproj) support, example, portrait , specify in view controller supported interface orientation not include portrait up.
- you telling system not auto rotate. should doing rotation manually. it's possible status bar rotate interface won't.
- 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
Post a Comment