2016-01-19 132 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

是的,对不起。天色已晚。 再次感谢您。 –