UIAlert没有显示

时间:2014-03-04 00:55:27

标签: ios uialertview

新鲜绿色的新手在这里。我刚刚开始编程,已经被UIAlert困住了。我在这个网站上搜索过,但有很多帖子,我说我对这一切都是新手,所以我不知道该找什么。这就是我所拥有的。

-(void)showError {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
                                                message:@"Please try again later. Have a nice day."
                                               delegate:nil
                                      cancelButtonTitle:@"Dismiss"
                                      otherButtonTitles:nil];
}

4 个答案:

答案 0 :(得分:1)

需要做

[alert show];

出席

答案 1 :(得分:1)

代码应该是:

-(void)showError {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
                                                message:@"Please try again later. Have a nice day."
                                               delegate:nil
                                      cancelButtonTitle:@"Dismiss"
                                      otherButtonTitles:nil];
[alert show];
[alert release];
}

答案 2 :(得分:0)

[alert show];

我也总是忘记这一点。快乐的编码。

答案 3 :(得分:0)

- (无效)showError {

   UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
                                  message:@"Please try again later. Have a nice day."
                                  delegate:nil
                                  cancelButtonTitle:@"Dismiss"
                                  otherButtonTitles:nil];

   [alert show];

}

相关问题