我使用下面的代码来显示UIAlertView
UIAlertView * messageBox = [[UIAlertView alloc] initWithTitle: @"title"
message: @""
delegate: nil
cancelButtonTitle: @"Cancel"
otherButtonTitles: nil];
[messageBox show];
然后我使用NSNotification postNotificationName来触发并希望删除或释放UIAlerView
-(void)notificationEntry:(NSNotification *)notification{
if (messageBox ) {
//[messageBox removeFromSuperview];//this does not work neither
[messageBox performSelectorOnMainThread:@selector(removeFromSuperview) withObject:nil waitUntilDone:NO];
messageBox = nil;
}
}
已触发通知,但
[messageBox removeFromSuperview];
[messageBox performSelectorOnMainThread:@selector(removeFromSuperview);
无效
您的评论欢迎