【发布时间】:2012-10-25 02:52:42
【问题描述】:
如果设备是 iPhone,我想将方向锁定为纵向,如果设备是 iPad,我想允许所有方向。
我有此代码,但它不会将 iPhone 锁定为纵向模式:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
{
return NO;
}
else
{
if (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown || interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight)
return YES;
}
return NO;
}
有什么问题?
【问题讨论】:
-
是的,iOS 6,但它应该支持
-
你写的东西可以在
标签: iphone locking orientation mode portrait