为何在使用故事板时存在另外两种观点

时间:2014-08-19 04:19:11

标签: ios objective-c

我的Xcode版本是5.1.1。 我使用单视图应用程序模板创建一个新项目,并在其上添加一个UIButton然后运行它,在此方法中:

- (void)viewDidAppear:(BOOL)animated {
        [super viewDidAppear:animated];
        NSLog(@"%@", [[UIWindow keyWindow] _autolayoutTrace]);
}

日志是:

*<UIWindow:0x750fa10>
|   *<UIView:0x7962b20>
|   |   *<UIView:0x7962c60>
|   |   *<UIView:0x79621c0>
|   |   *<UIRoundedRectButton:0x7618430> - AMBIGUOUS LAYOUT
|   |   |   <UIGroupTableViewCellBackground:0x7618e70>
|   |   |   <UIImageView:0x7619560>
|   |   |   <UIButtonLabel:0x761a920>

有两种观点。

如果我在这里覆盖它:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    ViewController *vc = [[ViewController alloc] init];
    self.window.rootViewController = vc;

    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    return YES;
}

日志是:

<UIWindow:0x8301700>
|   <UIView:0x10c03350>
|   |   <UIRoundedRectButton:0x10c036f0>
|   |   |   <UIGroupTableViewCellBackground:0x10c04080>
|   |   |   <UIImageView:0x10c048e0>
|   |   |   <UIButtonLabel:0x10c05cc0>

这里没有观点。 发生了什么事?自动布局机制可以做些什么吗?

0 个答案:

没有答案