希望你会好起来,尽力而为。
我在我的upSideDown Orientation
中遇到了一个问题,虽然我认为我做的一切都很完美,但我不知道为什么它不适合我。我正与你分享我的问题,以便得到任何解决办法。
我到目前为止所做的事:
a)中的xcode项目摘要选项卡,我已经启用了所有的4个方向。
b)我在我的所有控制器类中添加了一段代码(在下面编写)。
-(BOOL)shouldAutorotate
{
return YES;
}
-(NSInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
}
但是upSideDown Orientation
仍然不起作用
感谢你的期待。
发布于 2012-12-06 23:29:33
我已经找到了解决办法。
我们需要单独创建一个UINavigation Controller
类型的类。在.m
文件中添加以下方法
// Deprecated in iOS6, still needed for iOS5 support.
// ---
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
// return (interfaceOrientation == UIInterfaceOrientationPortrait);
return YES;
}
// iOS6 support
// ---
- (BOOL)shouldAutorotate
{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskAll;
}
Now将这个新创建的类分配给故事板中的Navigation Controller
。还在“Project -> Build设置->编译源”中添加该类的->文件。运行项目,它将支持和执行所有的方向,包括upSideDown
。
我希望它能帮助你们所有人。
问候
https://stackoverflow.com/questions/13720907
复制相似问题