UIToolBar
とを非表示にUINavigationBar
してUITouchGestureRecognizer
、同時に非表示にすることは可能UIWebView
ですか?同時に、残りのスペースを占めるように展開しますか?あと逆に同じことをするのも?
よろしくお願いします!
UIToolBar
とを非表示にUINavigationBar
してUITouchGestureRecognizer
、同時に非表示にすることは可能UIWebView
ですか?同時に、残りのスペースを占めるように展開しますか?あと逆に同じことをするのも?
よろしくお願いします!
使用する
-(void)didTap
{
[self.navigationController setNavigationBarHidden:YES animated:YES];
//remove your tool bar from superview
[toolbar removeFromSuperview];
//code to add ur UIWebView
}
トップ ナビゲーション バーを非表示にするには、アニメーション化する場合はnavigationBarHidden
プロパティまたはメソッドを使用します。setNavigationBarHidden:animated:
同様に、下部のツールバーのtoolbarHidden
プロパティまたはメソッドを使用します。setToolbarHidden:animated:
これらは の一部ですUINavigationController
。
ツールバーの非表示と展開の両方をアニメーション化する場合は、サイズの変更をメソッドUIWebView
でラップします。UIWebView
UIView animateWithDuration...
選択したジェスチャ認識エンジンを追加します。スワイプの場合は、インスタンスUISwipeGestureRecognizer
を作成してビューに追加します。あなたのviewDidLoad
方法でこのようなもの:
UISwipeGestureRecognizer *swipeGestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe)];
[self.view addGestureRecognizer:swipeGestureRecognizer];
そして、スワイプハンドラーは次のようになります:
-(void)handleSwipe{
if (self.navigationController.navigationBarHidden) {
[self.navigationController setNavigationBarHidden:NO animated:YES];
[self.navigationController setToolbarHidden:NO animated:YES];
[UIView animateWithDuration:0.3 animations:^{
self.webView.frame = CGRectMake(self.webView.frame.origin.x, self.webView.frame.origin.y, self.webView.frame.size.width, self.webView.frame.size.height - 88);
}];
} else {
[self.navigationController setNavigationBarHidden:YES animated:YES];
[self.navigationController setToolbarHidden:YES animated:YES];
[UIView animateWithDuration:0.3 animations:^{
self.webView.frame = CGRectMake(self.webView.frame.origin.x, self.webView.frame.origin.y, self.webView.frame.size.width, self.webView.frame.size.height + 88);
}];
}
}