【发布时间】:2013-02-16 15:25:17
【问题描述】:
我添加了一个带有自己的 xib 的自定义视图类。在 xib 中,File's Owner -> Custom Class 设置为“MyCustomView”。
我在情节提要中添加了一个空白视图,其类设置为“MyCustomView”
当我运行我的应用程序时,我没有看到我的视图正确显示。但是,我确实看到了2013-03-01 16:52:48.283 Test[56785:c07] MyCustomView initWithCoder
任何想法出了什么问题?
我在这里隔离了这个错误:http://bit.ly/YdDbqU
谢谢!
编辑:
- 我关闭了自动布局
-
我使用了以下内容:
UIView *subview = [[NSBundle mainBundle] loadNibNamed:@"MyCustomView" owner:self options:nil].lastObject; subview.frame = self.myCustomViewInstance.bounds; [self.view addSubview:subview];
一切正常!
【问题讨论】:
-
“正确显示”是什么意思。我看到一个空白的、白色的 UIView,应该是这样的
-
@CodaFi 以及 xib 有几个标签:1、2、3、4,...我指的是显示在主视图的空白处的 xib
标签: iphone ios objective-c cocoa