简体   繁体   中英

Xcode app is stuck in landscape mode

I've just recently begun learning to use Xcode and Objective-C. As usual, I decided to begin by learning how to create a Hello, World app. For some reason, even though I'm designing everything for portrait mode, it keeps showing landscape mode in the simulator and on my iPad 2. 在Xcode中 In Xcode 在iPad上的模拟器中 In the simulator an on the iPad

Here is the code of the view controller, if that helps at all.

#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

EDIT: With Red background 在此输入图像描述在此输入图像描述

Supported orientations was accidentally set to landscape. Set orientation on the project main screen in the Supported Orientations section or in the plist file.

在属性检查器中查看为“模式”选择了哪种语音。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM