窗口没有填满所有屏幕

时间:2016-01-19 20:25:29

标签: ios xamarin xamarin.ios mvvmcross

我是Xamarin的初学者,这是我的第一个App。我只是做了第一步:创建一个视图。我的问题是它没有填满所有的屏幕。我删除了视图然后,我创建了一个具有相同问题的窗口。

这是XIB:

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

1 个答案:

答案 0 :(得分:1)

该解决方案是在ViewDidLoad函数中添加此代码

        NavigationController.NavigationBarHidden = true;