如果XIB中有更多顶级视图,为什么outlet会变为nil

时间:2014-01-08 00:56:00

标签: ios uiviewcontroller xib

为什么在 willRotateToInterfaceOrientation:duration:来查看名为 second 的内容 ? xib中有两个顶级视图,第一个第二个出口指向它们。是否不允许在一个XIB中有两个顶级视图?我将XIB与UIViewController一起使用。 viewDidLoad 方法中仍然存在第二个出口。

enter image description here

1 个答案:

答案 0 :(得分:1)

我忘了将属性设置为,而不是。而且由于没有指向第二个视图的指针,它会被释放。

@property (strong, nonatomic) IBOutlet UIView *first;
@property (strong, nonatomic) IBOutlet UIView *second;
相关问题