我怎么才能解雇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];
}
发布于 2011-02-07 02:35:33
UIAlertView类的- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated
方法可以完成您想要的操作。例如:
[myAlertView dismissWithClickedButtonIndex:-1 animated:YES];
发布于 2012-01-27 18:31:23
由于您使用的是UIAlertView
的委托回调方法,因此我认为最好使用以下代码
[myAlertView dismissWithClickedButtonIndex:0 animated:YES];
如果不是,则使用上面建议的代码
[myAlertView dismissWithClickedButtonIndex:-1 animated:YES];
https://stackoverflow.com/questions/4915256
复制相似问题