我知道这个问题已经被问了几十次了。我有关于 SO 的所有答案,但仍然找不到问题:((((
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
设置了属性。所以我不明白到底出了什么问题:(