使用iOS 7显示UIAlertView时的标签栏行为异常 - 当警报解除时,应用程序会自动跳至最后一个标签

时间:2014-01-28 08:46:20

标签: ios ios7 uitabbarcontroller uialertview

我在Xcode 5的iOS应用程序中显示UIAlertView。它是一个标签式应用程序。 UIAlertView显示在默认选项卡(第一个选项卡)上,当解除警报视图时,应用程序会自动跳到第三个选项卡。

UIAlertView的

代码是:

[[AVAudioSession sharedInstance] requestRecordPermission:^(BOOL granted) {
    if (granted) {
        // Microphone enabled code

    }

    else {
        // Microphone disabled code
        recordButton.userInteractionEnabled = NO;
        microPhoneAlert = [[UIAlertView alloc]initWithTitle:@"Microphone is Turned Off" message:@"Message" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil];
        [microPhoneAlert show];
    }
}];

并以viwDidLoad编写。

,委托方法是:

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex 
      { 
         if(alertView == microPhoneAlert) 
             { 
              } 
       } 

有人能说出为什么会这样吗?

谢谢。 。 。 :)

1 个答案:

答案 0 :(得分:0)

我解决了。 。 。当我将委托设置为nil时,这很好:

recordButton.userInteractionEnabled = NO;
    microPhoneAlert = [[UIAlertView alloc]initWithTitle:@"Microphone is Turned Off" message:@"Message" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
    [microPhoneAlert show];