0

ナビゲーション バーを除いたフル ページの Web ビューの正しいフレームを取得するにはどうすればよいですか。

私はこれを試しました

CGRect screenFrame = [[UIScreen mainScreen]bounds];
webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, screenFrame.size.width, screenFrame.size.height-self.navigationController.navigationBar.bounds.size.height)];

しかし、下にスクロールすると、スクロールバーが切り取られます。webView のフレームの高さがまだ大きすぎるようです。

4

1 に答える 1

0

ナビゲーションバーがナビゲーションコントローラーから追加されたと仮定すると、次を使用できます。

self.view.bounds.size.height

ただし、IBなどで自分で追加した場合は、次を使用してください。

self.view.bounds.size.height - myNavBar.bounds.size.height

..。

webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)];
于 2013-01-04T15:58:02.807 に答える