0

こんにちは、テキストを表示するView Controllerを備えたアプリがあります-ツールバーとナビゲーションバーもあります。

ボタンを押して、ナビゲーションバーとツールバーの両方とステータスバーを非表示にし、テキスト付きのビューを全画面表示にし、ユーザーがビューをタップしてナビゲーションバーとツールバーを表示するようにします。

では、どうすればいいですか?ビューのフレーム プロパティで遊んでみましたが、成功しませんでした。

ここで編集は私のコードです。私の問題は1つだけです-ステータスバーがいっぱいではありません-それはただの黒いものです。

- (IBAction)goFullScreen:(id)sender {
    self.isFullScreenOn = !self.isFullScreenOn;
    if (self.isFullScreenOn) {
        self.navigationController.navigationBarHidden = NO;
        self.toolbar.hidden = NO;
        [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationSlide];
        self.view.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
    }else{
        [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
        self.navigationController.navigationBarHidden = YES;
        self.toolbar.hidden = YES;
        self.view.frame = CGRectMake(0, -60, self.view.frame.size.width, self.view.frame.size.height + 60);
    }
}
4

5 に答える 5

2

これを試して

[[UIApplication sharedApplication] setStatusBarHidden: YES withAnimation: UIStatusBarAnimationFade]; 

[self.navigationController setNavigationBarHidden:YES animated:YES];
于 2012-08-14T09:46:10.580 に答える
1

最初はバーを非表示にしない

self.currentView.toolBar.hidden=NO;

画面上のシングルタップで表示および非表示にするには、ビューコントローラーにタップジェスチャー認識機能を追加します

UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)];
    tapGesture.numberOfTapsRequired=1;
    [self.currentView addGestureRecognizer:tapGesture];
    [tapGesture release];

ここで、handleTapGesture 関数を次のように定義します。

-(void) handleTapGesture:(UITapGestureRecognizer *)sender {

     if(self.currentView.toolBar.alpha==1.0 ){

    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    [UIView setAnimationDuration:0.8];
    self.currentView.toolBar.alpha = 0.0;
    //similarly add other properties to be hidden like label,button etc
    [UIView commitAnimations]; 
}
else{

    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    [UIView setAnimationDuration:0.8];
    self.currentView.toolBar.alpha = 1.0;
    [UIView commitAnimations]; 
}

}

于 2012-08-14T11:12:20.360 に答える
1

ナビゲーションバーを非表示にするには: -

            self.navigationController.navigationBarHidden = YES ;

ステータスバーを非表示にするには: -

            [[UIApplication sharedApplication] setStatusBarHidden:YES];

hiddenツールバーのプロパティを設定

于 2012-08-14T09:42:32.157 に答える
0

hiddenナビゲーション バーとツールバーのプロパティを に設定しますYES

于 2012-08-14T09:39:56.427 に答える
0

presentModalViewController を使用して、新しい Viewcontroller を表示できます。単純に再度閉じることができ、リサイズを行う必要はありません。

于 2012-08-14T09:42:21.103 に答える