-2

クリックするとビューを表示し、もう一度クリックすると非表示にするために使用した次のコードは、正常に動作しますが、何度もクリックすると、ビューは非表示にならず、単にビューにとどまります。

- (IBAction)didTapFlag:(id)sender
{
checkBtnCondition=YES;
menuView.hidden=YES;
if([audioPlayer isPlaying])
{
    [self playPauseAudio];
}
if( iscommentOn==NO)
{
    [mCommentView hide];
    iscommentOn=YES;
}
else
{
     iscommentOn=NO;
        if(iscommentOn)
        if(![commentPlayer1 isPlaying])
          {
            iscommentOn=NO;
          }
        if(!iscommentOn)
          {
            iscommentOn=YES;
           if(mCommentView)
             {
                [commentPlayer1 stop];
                 commentPlayer1 = nil;
                [mCommentView hide];
                return;
            }
            float comx;
            float comy;
            if(UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPad)
            {
                comx = 200;
                comy = 280;
            }
            else
            {
                comx = 50;
                comy = 170;
            }
            mCommentView = [[CommentUtility alloc] initWithFrame:CGRectMake(comx, comy, 330, 250)];
            [mCommentView setDelegate:(id)self];
            [self.view addSubview:mCommentView];
            [mCommentView show];
         }
      }
   }

コードにどのような変更を加える必要がありますか、コードに問題がある場合は、助けてください。

4

1 に答える 1