我正在从 UIActionSheet 的 clickButtonAtIndex 函数启动 UIActivityIndicator。这是代码
+(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
NSLog(@"AS Button Clicked %d",buttonIndex);
UIActivityIndicatorView *indicator=[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
indicator.frame=CGRectMake(10, 10, 56, 56);
[indicator startAnimating];
[[actionSheet superview] addSubview:indicator];
}
下面给出了启动 UIActionSheet 的代码
UIActionSheet * actionSheet = [[UIActionSheet alloc] initWithTitle: nil
delegate: self
cancelButtonTitle: nil
destructiveButtonTitle: @"Cancel"
otherButtonTitles: @"Button1",
@"Button2", nil];
[actionSheet showFromRect: rect inView: view animated: YES];
但是,单击按钮的那一刻,UIActivityIndicator 会与 UIActionSheet 一起消失。
我在这里想念什么?