[英]Xcode app is stuck in landscape mode
我剛剛開始學習使用Xcode和Objective-C。 像往常一樣,我決定開始學習如何創建一個Hello,World應用程序。 出於某種原因,即使我正在為肖像模式設計所有內容,它仍然在模擬器和iPad 2上顯示橫向模式。 在Xcode中
在iPad上的模擬器中
這是視圖控制器的代碼,如果這有幫助的話。
#import "LCViewController.h"
@interface LCViewController ()
@end
@implementation LCViewController
@synthesize helloButton;
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidUnload
{
[self setHelloButton:nil];
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
- (IBAction)showAlert:(id)sender {
UIAlertView* alert = [[UIAlertView alloc] initWithTitle: @"Hello!"
message:@"Hello, world!"
delegate:nil
cancelButtonTitle:@"Close"
otherButtonTitles:nil];
[alert show];
[helloButton setTitle:@"I was clicked!" forState:UIControlStateNormal];
}
@end
編輯:紅色背景
支持的方向被意外設置為橫向。 在“支持的方向”部分或plist文件中的項目主屏幕上設置方向。
在屬性檢查器中查看為“模式”選擇了哪種語音。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.