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);
}
}
- (BOOL)isPadLandscape
{
return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad
&& (self.interfaceOrientation == UIInterfaceOrientationLandscapeRight
|| self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft));
}
- (BOOL)isPadPortrait
{
return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad
&& (self.interfaceOrientation == UIInterfaceOrientationPortrait
|| self.interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown));
}
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if ([self isPadPortrait])
{
[imageView setFrame:CGRectMake(0, -50, 768, 1024)];
}
else if ([self isPadLandscape])
{
[imageView setFrame:CGRectMake(0, 0, 1024, 768)];
}
}
我打電話 - 在調試期間(BOOL)isPadLandscape方法,但該方法不叫,
什麼可能是錯的?
如果其iPad應用程序,那麼爲什麼會出現「iPhone」的稱號?你應該確保你輸入的內容真的很有意義。請務必確保您在標籤字段中單獨指定標籤,但將標籤放在標題中確實很有意義。 – EmptyStack