2016-08-02 73 views
0

我在故事板上的View Controller中嵌入了一個表格視圖。表視圖中有3個表格視圖單元格。每個單元格中都有一個文本字符:「A」,「B」和「C」。這些字符在我的Visual Studio屏幕上可見,但是當我在模擬器中運行應用程序時,我什麼都看不到。我再次檢查表/單元格是否啓用。下面是Storeboard XML。Xamarin for VS Table查看單元格不顯示標籤文本

<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r"> 
    <dependencies> 
     <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/> 
    </dependencies> 
    <scenes> 
     <!--View Controller--> 
     <scene sceneID="tne-QT-ifu"> 
      <objects> 
       <viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController"> 
        <layoutGuides> 
         <viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/> 
         <viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/> 
        </layoutGuides> 
        <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC"> 
         <rect key="frame" x="0.0" y="0.0" width="600" height="600"/> 
         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> 
         <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> 
         <subviews> 
          <containerView contentMode="scaleToFill" id="5" translatesAutoresizingMaskIntoConstraints="NO" fixedFrame="YES"> 
           <rect key="frame" x="116" y="126" width="320" height="300"/> 
           <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> 
           <connections> 
            <segue id="66" destination="13" kind="embed"/> 
           </connections> 
          </containerView> 
         </subviews> 
        </view> 
       </viewController> 
       <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/> 
      </objects> 
      <point key="canvasLocation" x="0.0" y="0.0"/> 
     </scene> 
     <scene sceneID="12"> 
      <objects> 
       <tableViewController id="13" sceneMemberID="viewController"> 
        <tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="14"> 
         <rect key="frame" x="0.0" y="0.0" width="320" height="300"/> 
         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> 
         <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> 
         <prototypes> 
          <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="17" rowHeight="44"> 
           <rect key="frame" x="0.0" y="22" width="320" height="44"/> 
           <autoresizingMask key="autoresizingMask"/> 
           <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="17" id="18"> 
            <rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/> 
            <autoresizingMask key="autoresizingMask"/> 
           </tableViewCellContentView> 
          </tableViewCell> 
          <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="72" rowHeight="44" indentationLevel="0" style="IBUITableViewCellStyleDefault" textLabel="76"> 
           <rect key="frame" x="0.0" y="66" width="320" height="44"/> 
           <autoresizingMask key="autoresizingMask"/> 
           <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="72" id="73"> 
            <rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/> 
            <autoresizingMask key="autoresizingMask"/> 
            <subviews> 
             <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="A" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="76"> 
              <rect key="frame" x="16" y="0.0" width="288" height="43.5"/> 
              <autoresizingMask key="autoresizingMask"/> 
              <fontDescription key="fontDescription" type="system" pointSize="18"/> 
              <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> 
              <nil key="highlightedColor"/> 
             </label> 
            </subviews> 
           </tableViewCellContentView> 
          </tableViewCell> 
          <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="77" rowHeight="44" style="IBUITableViewCellStyleDefault" textLabel="81"> 
           <rect key="frame" x="0.0" y="110" width="320" height="44"/> 
           <autoresizingMask key="autoresizingMask"/> 
           <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="77" id="78"> 
            <rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/> 
            <autoresizingMask key="autoresizingMask"/> 
            <subviews> 
             <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="B" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="81"> 
              <rect key="frame" x="16" y="0.0" width="288" height="43.5"/> 
              <autoresizingMask key="autoresizingMask"/> 
              <fontDescription key="fontDescription" type="system" pointSize="18"/> 
              <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> 
              <nil key="highlightedColor"/> 
             </label> 
            </subviews> 
           </tableViewCellContentView> 
          </tableViewCell> 
          <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="79" rowHeight="44" style="IBUITableViewCellStyleDefault" textLabel="82"> 
           <rect key="frame" x="0.0" y="154" width="320" height="44"/> 
           <autoresizingMask key="autoresizingMask"/> 
           <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="79" id="80"> 
            <rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/> 
            <autoresizingMask key="autoresizingMask"/> 
            <subviews> 
             <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="82" text="C"> 
              <rect key="frame" x="16" y="0.0" width="288" height="43.5"/> 
              <autoresizingMask key="autoresizingMask"/> 
              <fontDescription key="fontDescription" type="system" pointSize="18"/> 
              <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> 
              <nil key="highlightedColor"/> 
             </label> 
            </subviews> 
           </tableViewCellContentView> 
          </tableViewCell> 
         </prototypes> 
         <connections> 
          <outlet property="dataSource" destination="13" id="15"/> 
          <outlet property="delegate" destination="13" id="16"/> 
         </connections> 
        </tableView> 
       </tableViewController> 
       <placeholder placeholderIdentifier="IBFirstResponder" id="19" userLabel="First Responder" sceneMemberID="firstResponder"/> 
      </objects> 
      <point key="canvasLocation" x="646" y="-5"/> 
     </scene> 
    </scenes> 
</document> 
+0

[外面的UITableViewController靜態表視圖]的可能的複製(http://stackoverflow.com/questions/22364230/static-table-view-outside-uitableviewcontroller) –

回答

0

答案可以在下面的鏈接中找到。雖然該鏈接中的討論是針對Xcode的,但解決方案是一樣的。創建一個表視圖控制器。將容器視圖添加到View Controller中,並在其中嵌入Table View Controller。將表格視圖內容更改爲「靜態單元格」,然後添加一個部分。從那裏你可以編輯你的簡單的表,應該採取一步,但不知何故花了5!

Xamarin應該刪除在屬於非靜態單元格內容表的單元格中添加文本太多標籤的功能。這只是混亂。

Static table view outside UITableViewController

相關問題