【发布时间】:2013-08-02 06:11:32
【问题描述】:
我正在使用UIAlertview 和viewdidload() 中的那个活动指示器。但我尝试在延迟后将其从超级视图中删除,但在使用以下代码删除UIAlertview 后,我无法在应用程序中执行任何操作.就像一个新的透明层仍在我的视野上方运行。
代码
-(void)startAlertActivity
{
_alertView = [[UIAlertView alloc] initWithTitle:@"Loading "
message:@"\n"
delegate:self
cancelButtonTitle:nil
otherButtonTitles:nil];
spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
spinner.center = CGPointMake(139.5, 75.5); // .5 so it doesn't blur
[_alertView addSubview:spinner];
[spinner startAnimating];
[_alertView show];
[_alertView performSelector:@selector(stopAlertActivity) withObject:self afterDelay:5.0];
}
-(void)stopAlertActivity
{ [spinner stopAnimating];
[_alertView dismissWithClickedButtonIndex:0 animated:YES];
}
ITS 看起来像一个仍在屏幕上运行的透明层,我该如何关闭它?
示例图片....
对我来说,警报现在不在屏幕上,但背景是浅蓝色的
崩溃报告
[UIAlertView stopAlertActivity]: unrecognized selector sent to instance 0x9ab5eb0
2013-08-02 12:20:43.822 AssamKart[5719:12203] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIAlertView stopAlertActivity]: unrecognized selector sent to instance 0x9ab5eb0'
*** First throw call stack:
【问题讨论】:
-
您是否使用任何第三方控件?
-
nop.iam 仅使用 alertview 和 indicator
-
问题在于
[_alertView performSelector:@selector(stopAlertActivity) withObject:self afterDelay:5.0];将其更改为:[self performSelector:@selector(stopAlertActivity) withObject:self afterDelay:5.0];
标签: ios objective-c uiview uialertview uiactivityindicatorview