gpt4 book ai didi

ios - Xcode Storyboard - 项目未出现

转载 作者:行者123 更新时间:2023-11-29 12:22:06 25 4
gpt4 key购买 nike

我的 Storyboard 中的细节场景中有一个UIView,最奇怪的事情发生了。当我尝试添加一个简单的UILabel 然后运行我的应用程序时,它没有出现。太奇怪了。

这是我的整个 Split View Controller 的屏幕截图,其中包含详细场景:

enter image description here

enter image description here

enter image description here

这是我的 Segue 代码:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

if ([[segue identifier] isEqualToString:@"showDetail"]) {
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
NSString *strPOIndex = [self.tableData[indexPath.row] valueForKey:@"Vendor"];
LHContactsDetail *controller = (LHContactsDetail *)[[segue destinationViewController] topViewController];
[controller setDetailItem:strPOIndex];
controller.navigationItem.leftBarButtonItem = self.splitViewController.displayModeButtonItem;
controller.navigationItem.leftItemsSupplementBackButton = YES;
}

}

我能够将项目添加到主场景导航项目。但是当我运行应用程序时,我添加到 Detail 场景的标签没有出现。

有什么建议吗?

最佳答案

嗯,这种问题很容易调试,你应该学会如何调试。

只需在 xcode 中启用 View 调试,并利用 lldb,只需打印出 UILabel 对象并检查它是否在其父 View 中,以及父 View 是否在窗口中等。

例如:如果你知道你的标签对象是0x12345678,

在 lldb 上,输入

po [0x12345678 super View ];

如果你看到它是 nil,那么 UILabel 没有被添加到 superview

如果它有一个有效的 UIView 对象,您可能想要重复以查看问题出在哪里。 View 调试是一个非常强大的 View 调试工具。

关于ios - Xcode Storyboard - 项目未出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30315450/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com