Monotouch尺寸没有意义

时间:2013-04-17 13:50:17

标签: c# xamarin.ios

我的AppDelegate中有以下内容:

        const string fileName = "Content/tandc.html";
        window = new UIWindow(UIScreen.MainScreen.Bounds);

        var webView = new UIWebView(new RectangleF(0,-20, 300, 300));
        string localHtmlUrl = Path.Combine(NSBundle.MainBundle.BundlePath, fileName);
        webView.LoadRequest(new NSUrlRequest(new NSUrl(localHtmlUrl, false)));
        webView.ScalesPageToFit = false;
        webView.Opaque = false;
        webView.BackgroundColor = UIColor.Clear;

        var webelement = new UIViewElement("", webView, true);

        var agree = new StyledStringElement("Agree", () => Console.WriteLine("test"));
        var noAgree = new StyledStringElement("Whatever", () => Console.WriteLine("test"));


        var headerView = new UIImageView(new RectangleF(0, 0, 640, 85))
                              {
                                  Image = UIImage.FromFile("Images/SafeWork_TandC_640_165.png")
                              };

        var section = new Section()
        {
            HeaderView = headerView
        };

      window.RootViewController = new DialogViewController(new RootElement("Login") {
               section,
               new Section()
                   {
                     webelement
                   },
                   new Section()
                       {
                          agree, noAgree
                       }
            });



        window.MakeKeyAndVisible();
        return true;

我的问题是 - 为什么WebView的尺寸与实际窗口的尺寸完全无关?标题图像的宽度为640px,使其成为iPhone的宽度,而webview的宽度为300以使其适合 - 400对于屏幕而言太大了,如果设置为它,它实际上会脱离屏幕? / p>

1 个答案:

答案 0 :(得分:0)

简短回答:视网膜。

窗口尺寸采用非视网膜像素,以便遗留应用程序正常运行。因此,如果您的设备支持视网膜显示,640px宽的图像将占用320px的屏幕单位。