2013-04-17 24 views
0

我有以下的在我的AppDelegate:MonoTouch的尺寸不決策意識

 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; 

我的問題是 - 爲什麼是web視圖完全不相關的尺寸爲實際窗口的尺寸?標題圖片的寬度爲640px,使其成爲iPhone的寬度,但webview的寬度爲300,以使其適合 - 對於屏幕來說,400對於屏幕來說太大了,並且如果設置爲屏幕,屏幕實際上會熄滅嗎?

回答

0

簡答:視網膜。

窗口尺寸位於非視網膜像素中,以允許傳統應用正常運行。因此,如果您的設備支持視網膜顯示,則640px寬的圖像將佔用320px的屏幕單位。

+0

想要看起來,這些被稱爲「點」,而不是像素。非視網膜:1px == 1pt,視網膜:2px == 1 pt。這樣,你總是可以參考點而不考慮視網膜。 –