3

UIToolBarとを非表示にUINavigationBarしてUITouchGestureRecognizer、同時に非表示にすることは可能UIWebViewですか?同時に、残りのスペースを占めるように展開しますか?あと逆に同じことをするのも?

よろしくお願いします!

4

2 に答える 2

3

使用する

-(void)didTap
{
[self.navigationController setNavigationBarHidden:YES animated:YES];
//remove your tool bar from superview
[toolbar removeFromSuperview];
//code to add ur UIWebView

}
于 2012-12-31T04:41:36.137 に答える
3

トップ ナビゲーション バーを非表示にするには、アニメーション化する場合はnavigationBarHiddenプロパティまたはメソッドを使用します。setNavigationBarHidden:animated:同様に、下部のツールバーのtoolbarHiddenプロパティまたはメソッドを使用します。setToolbarHidden:animated:これらは の一部ですUINavigationController

ツールバーの非表示と展開の両方をアニメーション化する場合は、サイズの変更をメソッドUIWebViewでラップします。UIWebViewUIView 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);
       }];
    }
}
于 2012-12-31T04:30:14.377 に答える