2016-08-02 21 views
0

Ich habe eine Tabellenansicht in einen View-Controller auf meinem Storyboard eingebettet. In der Tabellenansicht befinden sich 3 Tabellenansichtszellen. Jede Zelle hat ein Zeichen Text: "A", "B" und "C". Die Zeichen sind auf meinem Bildschirm in Visual Studio sichtbar, aber wenn ich die App im Simulator starte, sehe ich nichts. Ich habe überprüft, dass die Tabelle/Zellen aktiviert sind. Storeboard XML unten.Xamarin für VS-Tabellenansicht Zellen, die keinen Beschriftungstext anzeigen

<?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

Mögliche Duplikat [Static Tabellenansicht außerhalb UITableViewController] (http://stackoverflow.com/questions/22364230/static-table-view-outside-uitableviewcontroller) –

Antwort

0

Die Antwort finden Sie im folgenden Link. Obwohl die Diskussion in diesem Link für Xcode ist, ist die Lösung die gleiche. Erstellen Sie einen Tabellenansicht-Controller. Fügen Sie Ihrem View-Controller eine Container-Ansicht hinzu und betten Sie den Table View-Controller darin ein. Ändern Sie den Inhalt der Tabellenansicht in "Statische Zellen" und fügen Sie einen Abschnitt hinzu. Von dort können Sie Ihre einfache Tabelle bearbeiten, die einen Schritt hätte machen sollen, aber irgendwie 5 genommen hat!

Xamarin sollte die Möglichkeit zum Hinzufügen von Text zu Beschriftungen in Zellen entfernen, die zu einer nicht statischen Zelleninhaltstabelle gehören. Es ist nur verwirrend.

Static table view outside UITableViewController