; 行为奇怪
我有一个通用的应用程序,支持iPad的所有方向,只有iPhone / iPod的potrait。 我的代码看起来有点像这样:
@implementation UIViewController ( interfaceOrientationHack ) - (void) shouldAutorotateToInterfaceOrientation: ( UIInterfaceOrientation ) toInterfaceOrientation { if( iPad ) { return YES; } else if( toInterfaceOrientation == UIInterfaceOrientationPotrait ) { return YES; } else return NO; } @end
从我的一个控制器中,我启动了一个导航控制器作为模态视图控制器
[ self presentModalViewController: c animated: YES ];
目前的问题是,模态控制器在方向上正确启动,但是当我改变方向时,模态控制器不改变其方向,其余的控制器都正常工作。
任何帮助将非常感激。 提前致谢。
从UIViewcontroller类的引用:“默认情况下,UIViewController类只在肖像模式下显示视图。为了支持额外的方向,你必须重写shouldAutorotateToInterfaceOrientation:方法并返回YES你的子类支持的任何方向如果你的视图的autoresizing属性被configuration正确的,这可能是你所要做的。“
由于你的模态视图inheritance自UIViewcontroller,所以你必须重写shouldAutorotateToInterfaceOrientation:在你的模态视图中。
- iOS 8 UIActivityViewController和UIAlertControllerbutton文本颜色使用窗口的tintColor
- UITableViewCell textLabel和内容视图都可见?
- estimatedHeightForRowAt不被调用滚动
- UItableviewcell在ios中重用问题
- 相对date格式,过去date的输出?
- 接口本地化
- 如何解决EXC_BAD_ACCESS(SIGSEGV)上的KERN_INVALID_ADDRESS
- DFP广告pipe理系统广告 – 为插页式广告设置Facebook受众群体调解(AdUnit + LineItem + creative)
- 'Receiver(<ViewController>)没有标识符“addSegue”