iphone - 如何关闭 UIAlertView?

标签 iphone uialertview

如何关闭 UIAlertView ?此代码不起作用。

@property (nonatomic, retain) UIAlertView *activityAlertView;
- (void)viewDidLoad 
{
self.activityAlertView = [[UIAlertView alloc] initWithTitle:@"Receiving data" message:@"\n\n"
                                                         delegate:self
                                                cancelButtonTitle:@"Cancel"
                                                otherButtonTitles:nil, nil];  
[activityAlertView show];
}

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

-(void) myfunc
{
[self alertView:activityAlertView clickedButtonAtIndex:1];
}

最佳答案

UIAlertView 类的 - (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndexAnimated:(BOOL)animated 方法可以满足您的需求。例如:

[myAlertView dismissWithClickedButtonIndex:-1 animated:YES];

关于iphone - 如何关闭 UIAlertView?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4915256/

相关文章:

iphone - XMPPFramework 未发送存在信息

iphone - 如何在不像素化的情况下调整(缩小)UIView 的大小?

ios - 在iOS应用崩溃后显示AlertView

iOS 显示一个带有运行时间的 UIAlertView

ios - 如何在 objective-c 中更新UITableView中先前选择的行时如何显示带有复选标记的选定行

iphone - 配置时没有为参数 'appIdName' 提供值

iphone - 进入后台时如何争取时间完全关闭 UIAlertView?

iphone - 无法更新 uitableview 行

ios - Xcode 在 UITableRowSelection 之后显示 UIAlertView?

iphone - UIDocumentsInteractionController 显示 iBooks 但不打开它