如何运行下面的方法从另一个方法运行shouldAutorotateToInterfaceOrientation?
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {}
从另一个方法是什么? (所以新的因素可能会影响方向)
如何运行下面的方法从另一个方法运行shouldAutorotateToInterfaceOrientation?
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {}
从另一个方法是什么? (所以新的因素可能会影响方向)
此方法返回允许的方向(纵向,纵向上移,横向和横向)。调用这个方法不会做任何事,因为你的类不应该动态地改变方向。
你想达到什么目的?
该方法不会导致接口旋转,它只是决定设备是否允许。
所以,如果你想改变你用来确定是否允许旋转的因素,你必须创建一个实例变量。
让您的标题是这样的:
@interface MyClassName : NSObject {
BOOL canLandscape;
}
在你的 “其他” 的方法,设置标志(canLandscape = YES;
)。
在你shouldAutorotateToInterfaceOrientation:
,您可以检查此来帮助你决定
if (canLandscape) {
...dosomethinghere...
}