题
嗨,我有这个代码...
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
和
- (void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if(UIInterfaceOrientationIsPortrait(interfaceOrientation)){
// WTF, this runs when I change to Landscape
} else {
// this runs when I change to Portrait??? shouldn't it be the contrary?
}
}
如您所见,代码是反向运行的,我的意思是,当我更改肖像设备时,该部分应运行,代码的景观部分运行,反之亦然。
当我转动设备时,self.view旋转。
这个uiinterfaceorientationisportrait测试旋转之前的接口是如何的,还是我缺少某些东西?
谢谢你的帮助。
解决方案
请注意,该方法被命名为recrotate从界面方向,因此自然而然 interfaceOrientation
参数包含旧方向,而不是新方向。
不隶属于 StackOverflow