[英]UIAlertView removeFromSuperview does not work
我使用下面的代碼來顯示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);
沒有辦法
歡迎您發表評論
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.