1
我正在开发iPhone/iPad应用程序。iPad后退按钮停止旋转工作
问题是,当我将ipad肖像的方向更改为横向时,导航控制器的后退按钮停止工作。
它“的工作很好,当没有改变方向。
我使用这个代码
- (BOOL) isPad{
#ifdef UI_USER_INTERFACE_IDIOM
return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad);
#else
return NO;
#endif
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
if ([self isPad]) {
return YES;
}
else
{
return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}
}
什么”发错用此代码?
这可以工作,但是也可以在UIView及其组件上设置正确的AutoResizingMask值。最好是通过Interface Builder来完成,但可以通过程序设置。 – Jake