2013-08-28 143 views
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. 

我在調試器中檢查,發現viewtableView屬性設置。所以,我不明白究竟是什麼錯:(

+0

「我檢查了調試器,看到'view'和'tableView'屬性被設置了。」什麼是*不*然後設置? – dasblinkenlight

+0

@dasblinkenlight我不知道。這就是爲什麼我不明白爲什麼它仍然崩潰。 – expert

+0

如果沒有設置屬性,它們將是'nil',所以事情不會崩潰。它是否包含隨機的東西? – dasblinkenlight

回答

3

看起來就像是Xcode中5的bug。

我沒有從GitHub和比較文件夾乾淨的檢出。

目前還沒有更改代碼只對不同的文件被:

  • MyProject.xcccheckout
  • UserInterfaceState.xcuserstate

恢復UserInterfaceState.xcuserstate使異常消失。

所以記住這一點,夥計們。問題可能不在你的代碼中。

相關問題