2014-02-20 43 views
0

期間我想顯示一條消息,一個UIAlertView中,我需要更新它的警戒展會期間消息。 我用下面的代碼:更新UIAlertView中消息後/展iOS7

UIAlertView alert = [UIAlertView new]; 
[alert setMessage:@"Blah blah"]; 
[alert show]; 

,我希望它在一個更新的NSTimer方法來更新:

[alert setMessage:@"Blah blah ..."]; 

上面的代碼iOS6的/ 5只是工作得很好! 但它不適用於iOS7。

這是什麼問題,我該怎麼解決呢?

+0

我希望它每1秒更新一次! – aakpro

回答

0

在您的接口文件添加UIAlertViewDelegate

,並添加您的實現文件下面的方法。

NSTimer *countdownTimer = [NSTimer scheduledTimerWithTimeInterval: 60.0 target: self selector: @selector(alertForEveryOneMinute) userInfo: nil repeats: YES]; 

然後實現alertForEveryOneMinute方法在實現文件中,並從該方法顯示的提醒:

- (void)willPresentAlertView:(UIAlertView *)alertView { 
    alertView.message = @"Message to be changed"; 
} 

編輯

要顯示警報實現下面的代碼。

+0

我應該如何使用nstimer更新方法? – aakpro