如何关闭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)buttonIndex animated:(BOOL)animated
方法可以满足您的需求。例如:
[myAlertView dismissWithClickedButtonIndex:-1 animated:YES];
关于iphone - 如何关闭UIAlertView?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/4915256/