简体   繁体   English

UIDeviceOrientationPortrait,iOS 6和7,InterfaceOrientation

[英]UIDeviceOrientationPortrait , ios 6 & 7 , InterfaceOrientation

i have this code i want to go to another uiview but i want to have showing this view (second view) in portrait mode only and the notification in first view doesn't work in second view ; 我有此代码,我想转到另一个uiview,但我只想以纵向模式显示此视图(第二视图),而在第二视图中的通知在第一视图中不起作用;

is there any way to change the for this 有什么办法可以改变这个吗

   [[NSNotificationCenter defaultCenter] removeObserver:self];

    view2 *viewController = [[[view2 alloc] init] autorelease];
    UINavigationController *navController = [[[UINavigationController alloc] initWithRootViewController:viewController] autorelease];

    viewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
    [self presentModalViewController:navController animated:NO];

i want exactly one function same this code in ios >6 我想要一个完全相同的功能,此代码在ios> 6中

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

    return NO;
}

Try subclassing the UINavigationController and override the following methods : 尝试子类化UINavigationController并重写以下方法:

- (BOOL)shouldAutorotate
{
    return YES;
}

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何分辨iOS 8中的目标界面方向? - How to tell the target interfaceOrientation in iOS 8? 如何知道iOS 8中的当前interfaceOrientation? - How to know current interfaceOrientation in iOS 8? iOS 5中“ self.interfaceOrientation”未更新 - “self.interfaceOrientation” not getting updated in iOS 5 如何知道iOS 8扩展中的当前interfaceOrientation? - How to know current interfaceOrientation in extension of iOS 8? self.interfaceOrientation导致在iOS 4.x上调用shouldAutorotateToInterfaceOrientation - self.interfaceOrientation causing shouldAutorotateToInterfaceOrientation to be called on iOS 4.x 在iOS6中,将ViewController推入堆栈时强制将ViewController强制为特定的interfaceOrientation - In iOS6, trouble forcing ViewController to certain interfaceOrientation when pushed on stack Swift,让我着迷于此:iOS 8.0中不推荐使用interfaceOrientation - Swift, has got me on this one: interfaceOrientation was deprecated in iOS 8.0 iOS 8 中不推荐使用“interfaceOrientation”,如何更改此方法 Objective C - “interfaceOrientation” is deprecated in iOS 8, How to change this method Objective C 界面方向iPad - interfaceOrientation iPad iPhone以编程方式设置interfaceorientation - iPhone set interfaceorientation programmatically
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM