iPhone - 界面方向颠倒?
问题描述:
您好我有这样的一段代码...iPhone - 界面方向颠倒?
- (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测试接口在旋转之前的方式还是我错过了什么?
感谢您的任何帮助。
答
请注意,该方法被命名为didRotate 从 InterfaceOrientation,所以自然interfaceOrientation
参数包含旧的方向,而不是新的方向。
ahhh ....显然!我从来没有注意到名字中的FROM ......哈哈。谢谢。 – SpaceDog 2010-02-20 16:20:36