2016-01-19 191 views
1

我是Xamarin的初學者,這是我的第一個應用程序。我只是做了第一步:創建一個視圖。我的問題是它不能填滿所有的屏幕。我刪除了視圖,然後創建了一個具有相同問題的窗口。窗口不填滿所有屏幕

這是廈門國際銀行:

<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES"> 
    <dependencies> 
     <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/> 
    </dependencies> 
    <objects> 
     <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="LoginView"> 
      <connections> 

       <outlet property="window" destination="7" id="176-fQ-JAJ"/> 
      </connections> 
     </placeholder> 
     <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> 
     <window opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="7"> 
      <rect key="frame" x="0.0" y="0.0" width="320" height="568"/> 
      <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> 
      <simulatedStatusBarMetrics key="simulatedStatusBarMetrics"/> 
      <simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/> 
      <point key="canvasLocation" x="-0.2000008" y="20.2"/> 
      <subviews> 
       <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Label" lineBreakMode="tailTruncation" minimumFontSize="10" id="8" translatesAutoresizingMaskIntoConstraints="NO" fixedFrame="YES"> 
        <rect key="frame" x="139" y="33" width="42" height="21"/> 
        <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> 
        <fontDescription key="fontDescription" type="system" pointSize="17"/> 
        <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> 
        <nil key="highlightedColor"/> 
       </label> 
      </subviews> 
     </window> 
    </objects> 
    <resources> 
     <image name="Media.xcassets/AppIcons.appiconset/ic_launcher_120x120.png" width="120" height="120"/> 
     <image name="Media.xcassets/AppIcons.appiconset/ic_launcher_152x152.png" width="152" height="152"/> 
     <image name="Media.xcassets/AppIcons.appiconset/ic_launcher_180x180.png" width="180" height="180"/> 
     <image name="Media.xcassets/AppIcons.appiconset/ic_launcher_29x29.png" width="29" height="29"/> 
     <image name="Media.xcassets/AppIcons.appiconset/ic_launcher_40x40.png" width="40" height="40"/> 
     <image name="Media.xcassets/AppIcons.appiconset/ic_launcher_58x58.png" width="58" height="58"/> 
     <image name="Media.xcassets/AppIcons.appiconset/ic_launcher_76x76.png" width="76" height="76"/> 
     <image name="Media.xcassets/AppIcons.appiconset/ic_launcher_80x80.png" width="80" height="80"/> 
     <image name="Media.xcassets/AppIcons.appiconset/ic_launcher_87x87.png" width="87" height="87"/> 
    </resources> 
</document> 

我在做什麼錯?提前致謝。

編輯。

public partial class LoginView : BaseView<LoginViewModel> 
    { 
     public LoginView() : base("LoginView", null) 
     { 
     } 

     public override void DidReceiveMemoryWarning() 
     { 
      base.DidReceiveMemoryWarning(); 

      // Release any cached data, images, etc that aren't in use. 
     } 

     public override void ViewDidLoad() 
     { 
      base.ViewDidLoad(); 

      NavigationController.NavigationBarHidden = true; 
      // Perform any additional setup after loading the view, typically from a nib. 
     } 

    } 

基本視角:

public abstract class BaseView<TViewModel> : MvxViewController, IView<TViewModel> where TViewModel : IViewModel 
    { 
     private IConfigurationService configurationService; 
     private IGlobalizationService globalizationService; 

     public BaseView(string nibName, NSBundle bundle) : base(nibName, bundle) 
     { } 

     public IConfigurationService ConfigurationService 
     { 
      get 
      { 
       if (this.configurationService == null) 
       { 
        this.configurationService = Mvx.Resolve<IConfigurationService>(); 
       } 

       return this.configurationService; 
      } 
     } 
     public IGlobalizationService GlobalizationService 
     { 
      get 
      { 
       if (this.globalizationService == null) 
       { 
        this.globalizationService = Mvx.Resolve<IGlobalizationService>(); 
       } 

       return this.globalizationService; 
      } 
     } 
     public new TViewModel ViewModel 
     { 
      get { return (TViewModel)base.ViewModel; } 
      set { base.ViewModel = value; } 
     } 

This is how the view is shwoing

+0

的可能的複製[iOS的應用程序不會佔滿iPhone屏幕]( http://stackoverflow.com/questions/25929565/ios-application-doesnt-fill-iphone-screen) – Jason

+0

我正在使用MVVM Cross,所以我不使用UIViewController或啓動屏幕。我也不使用Xcode ......我使用Visual Studio進行開發。我做了我自己的LaunchScreen,但沒有通過info.plist –

+1

調用它嗨Daniel,你如何建立你的視圖或ViewController? MvvmCross只是一個非常簡單的包裝本地iOS視圖控制器。你可以顯示實際的視圖控制器的代碼或如何創建視圖?我們需要更多的信息繼續下去。 – Stephanvs

回答

1

的解決方案是在viewDidLoad中功能添加此代碼

 NavigationController.NavigationBarHidden = true; 
+1

我很高興你解決了它,但你的「窗口不填充屏幕」的描述是可怕的不準確 – Jason

+0

是的,對不起。天色已晚。 再次感謝您。 –