我知道这个问题已经问过几十遍了。我已经知道了所有答案,但仍然找不到问题:((((
尝试使用Loaded nib but the view outlet was not set
激活视图时得到UITableViewController
。
请你帮助我好吗 ?以下是我的xib。我出于绝望而添加了连接,但这无济于事。
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="4504" systemVersion="12E55" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment defaultVersion="1536" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3734.1"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewController id="Ure-ya-PJB" customClass="BRSMyListRootViewController">
<tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="NFR-CB-kzq">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</tableView>
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics"/>
<nil key="simulatedTopBarMetrics"/>
<nil key="simulatedBottomBarMetrics"/>
<simulatedOrientationMetrics key="simulatedOrientationMetrics"/>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/>
<refreshControl key="refreshControl" opaque="NO" multipleTouchEnabled="YES" contentMode="center" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" id="jJO-vh-VBh">
<autoresizingMask key="autoresizingMask"/>
</refreshControl>
<connections>
<outlet property="view" destination="NFR-CB-kzq" id="RYK-D4-fda"/>
<outlet property="tableView" destination="NFR-CB-kzq" id="RYK-D4-fdb"/>
</connections>
</tableViewController>
</objects>
</document>
我的界面看起来像这样
@interface BRSMyListRootViewController : UITableViewController
@end
并且实现很大。我将其发布在Gist上:https://gist.github.com/cppexpert/6364570
我初始化此控制器的方式是:
UINavigationController *vc0 = [[UINavigationController alloc] initWithRootViewController:
[[BRSMyListRootViewController alloc] initWithStyle:UITableViewStylePlain]];
UINavigationController *vc1 = [[UINavigationController alloc] initWithRootViewController:
[[BRSCheckInViewController alloc] initWithStyle:UITableViewStyleGrouped]];
self.tabBarController = [[UITabBarController alloc] init];
[self.tabBarController setViewControllers:@[vc0, vc1]];
[self.window setRootViewController:self.tabBarController];
[self.window makeKeyAndVisible]; // It crashes here.
我检查了调试器,发现
view
和tableView
属性已设置。所以我不明白到底是什么错:( 最佳答案
看起来这是Xcode 5的错误。
我从github清理结帐并比较了文件夹。
没有代码更改。只有不同的文件是:
恢复
UserInterfaceState.xcuserstate
会使异常消失。所以请记住这一点,伙计们。问题甚至可能不在您的代码中。
关于ios - 已加载 Nib 但未设置 View 导出-UITableViewController,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/18485404/