1
我知道這個問題已被問幾十次。我已經真正的SO所有答案,但依然無法找到問題:當我試圖用UITableViewController
激活視圖((((加載的筆尖,但沒有設置視圖插座 - UITableViewController
我得到Loaded nib but the view outlet was not set
能否請你幫我下面是我的?廈門國際銀行。我加了絕望的連接,但它並不能幫助。
<?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
和實現挺大。我張貼在這裏要點: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
屬性設置。所以,我不明白究竟是什麼錯:(
「我檢查了調試器,看到'view'和'tableView'屬性被設置了。」什麼是*不*然後設置? – dasblinkenlight
@dasblinkenlight我不知道。這就是爲什麼我不明白爲什麼它仍然崩潰。 – expert
如果沒有設置屬性,它們將是'nil',所以事情不會崩潰。它是否包含隨機的東西? – dasblinkenlight