我的 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 的尺寸与实际窗口的尺寸完全不相关?标题图像的宽度为 640 像素,使其与 iPhone 的宽度相同,而 webview 的宽度为 300 以使其适合 - 400 对屏幕来说太大了,如果设置为它实际上会离开屏幕?