我的要求是在人像模式这是我的第一个视图 - 控制开only.and当用户进入第二视图 - 控制我想在风景模式控制器如何可以我这样做1日的ViewController在纵向和SecondViewController在横向模式
我试着这个代码
1 ViewController.m
- (BOOL)shouldAutorotate
{
returnc YES;
}
-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return UIInterfaceOrientationMaskPortrait;
}
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface
{
return (interface==UIInterfaceOrientationMaskPortrait);
}
守则第2 ViewController.m
- (BOOL)shouldAutorotate
{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskLandscapeLeft;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeRight;
//return UIInterfaceOrientationMaskLandscape;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight || interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
这对我来说工作不正常。
有什么不合适呢?描述你遇到的问题。 –
当用户去第二个控制器显示protrait模式我希望它在横向模式 – Jitendra
我回答了类似的问题,它可以帮助。 http://stackoverflow.com/questions/18185260/view-controllers-in-view-controller-and-orientation-ios/18185775#18185775 – BoranA