我有一个 UIwebview,我想填充顶部导航栏和底部标签栏之间的屏幕。我的 web 视图正在以编程方式定义,我正在使用如下框架对其进行初始化。
我已经能够通过对某些值进行硬编码来获得所需的行为,但我发现这并不适用于所有设备。具体来说,似乎不同的操作系统可能会将 (0,0) 视为屏幕上的不同点(一些是屏幕的左上角,而另一些则是导航栏下方的最左上角)。
我的问题是,如何设置 Web 视图的位置和大小以填充所有设备的屏幕?谁能解释为什么这不像我认为的那样?
//iphone 5s running iOS 8
webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, screenWidth, screenHeight+20)];
//iphone 5 running iOS 7
webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 64, screenWidth, screenHeight-93)];
//what i thought would work for all, but doesnt fill the height of the screen...
webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, screenWidth, screenHeight)];