iOS:在另一个 UIView 中加载 UIView
我正在尝试在另一个视图中加载 UIView 。
view01 设置为占据主视图上 50% 的垂直空间。 view01 连接到插座。我将使用 view01 在其上加载各种视图。现在我可以从备用 xib 文件加载 view02。
问题是有时有效有时无效。并且它这样做时没有对应用程序中使用的数据进行任何更改。所以我想知道这个间歇性问题的原因可能是什么?
这是要加载的代码:
statsView = [[StatsViewController alloc] initWithNibName:@"StatsViewController" bundle:nil];
[statsView setRiftIndex:riftIndex.characterSheet];
[statsView activateEditing:NO];
[listView addSubview:statsView.view];
还不能发布图像 :(
StatsViewController.xib 将 StatsViewController 类作为 xib 中的文件所有者。
I am trying to load a UIView inside another view.
view01 is set to take 50% vertical space on the main view. view01 is attached to an outlet. I will be using view01 to load various views on top of it. Now I am able to load view02 from an alternate xib file.
The problem is that sometimes it works and some times it doesn't. And it's doing this without any change to the data used in the app. So I am wondering what could be the reason for this intermittent problem?
This is the code to load:
statsView = [[StatsViewController alloc] initWithNibName:@"StatsViewController" bundle:nil];
[statsView setRiftIndex:riftIndex.characterSheet];
[statsView activateEditing:NO];
[listView addSubview:statsView.view];
Can't post images yet :(
The StatsViewController.xib has the StatsViewController class as the file-owner in the xib.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我终于找到了问题所在。有 2 个同名的 xib 文件,其中一个来自我之前所做的测试。每次我运行它时,链接器都会从一个切换到另一个。我确信我之前已经删除了该文件,但看起来我只删除了引用。
I finally found the problem. there was 2 xib files with the same name, one was from a previous test I had done. and the linker would alternate from one to the other every time I ran it. I was sure I had deleted the file before but it seams I had only removed the reference.