转 UIAlertView 不显示、屏幕变灰
生活随笔
收集整理的這篇文章主要介紹了
转 UIAlertView 不显示、屏幕变灰
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
UIAlertView 不顯示、屏幕變灰
SvenFang
1 票181
在[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(response:) name:url object:nil];的回調(diào)方法response里面彈出UIAlertView,當執(zhí)行到該代碼時,屏幕變灰,但是UIAlertView沒有出現(xiàn),背景按鈕均不可點擊,輸出得到UIAlertView對象的centre x和y均為0 ,alpha為1,等高人指點,下面是response方法的代碼和屏幕截圖- (void)response:(NSNotification *)notification
{if (isStop == 0) {//數(shù)據(jù)超時后,不作處理return;}if (isStop == 1) {[_timer invalidate];isStop = 0;}//停止等待控件
[spinner performSelectorOnMainThread:@selector(stopAnimating) withObject:nil waitUntilDone:NO];[spinner removeFromSuperview];CommentXMLParser *commentXML=[notification object];
// if([commentXML.responseDict objectForKey:@"return_result"]!=nil){
//
// NSLog(@"請求4001的返回---%@",[commentXML.responseDict objectForKey:@"return_result"]);
//
// if([[commentXML.responseDict objectForKey:@"return_result"] isEqualToString:RETURN_NO])
// {
// //這里只指網(wǎng)絡(luò)失敗
// cmd = commentXML.returnHeader.cmd;
// [self performSelectorOnMainThread:@selector(showDisconeect) withObject:nil waitUntilDone:NO];
// }
// }if(commentXML.done){ //如果有數(shù)據(jù)返回if([commentXML.returnHeader.rspcode isEqualToString:RESPONSE_SUCCESS]){//正確返回//解析協(xié)議if( [commentXML.returnHeader.cmd isEqualToString:B2B00004001]){score = [commentXML.responseDict objectForKey:@"integral_all"];score_can_use = [commentXML.responseDict objectForKey:@"integral_able"];balance = [commentXML.responseDict objectForKey:@"balance"];[self performSelectorOnMainThread:@selector(viewUpdateBaseInfo) withObject:nil waitUntilDone:NO];}else if([commentXML.returnHeader.cmd isEqualToString:B2B00004017]){gift_card_balance = [commentXML.responseDict objectForKey:@"balance"];[self performSelectorOnMainThread:@selector(viewUpdateBaseInfo) withObject:nil waitUntilDone:NO];}else if([commentXML.returnHeader.cmd isEqualToString:B2B00004002]){[[NSNotificationCenter defaultCenter] postNotificationName:@"Settlement" object:commentXML.responseDict];[self performSelectorOnMainThread:@selector(closePayTool) withObject:nil waitUntilDone:NO];}else{NSAssert(true, @"非法協(xié)議,本處理函數(shù)只處理4001,4017, 4002協(xié)議", nil);}}else{//如果業(yè)務(wù)失敗NSLog([commentXML.returnHeader.cmd stringByAppendingString:@"業(yè)務(wù)失敗, 失敗原因:%@"], [commentXML.headerDict objectForKey:@"rspdesc"]);//todo 提示業(yè)務(wù)失敗, 類似android的toast效果UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"提示" message:[commentXML.headerDict objectForKey:@"rspdesc"] delegate:nil cancelButtonTitle:@"確定" otherButtonTitles: nil];[alert show];[alert release];
// [OMGToast showWithText:[commentXML.headerDict objectForKey:@"rspdesc"] bottomOffset:10 duration:5];
}}評論 (1) ? 分享 ? 鏈接 ? 2012-09-11
0
Alert的delegate設(shè)置了嗎? – 吳復 2012-09-11
1個答案 票 數(shù)
davidzhang
0 票
1
在這里面我建議你這樣做,將下面這段代碼//todo 提示業(yè)務(wù)失敗, 類似android的toast效果UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"提示" message:[commentXML.headerDict objectForKey:@"rspdesc"] delegate:nil cancelButtonTitle:@"確定" otherButtonTitles: nil];[alert show];改為[alert performSelectorOnMainThread:@selector(show) withObject:nil waitUntilDone:YES];如果還是不明白,可以參考這里http://www.gowhich.com/blog/206
轉(zhuǎn):http://www.dewen.org/q/5474
轉(zhuǎn)載于:https://www.cnblogs.com/ygm900/p/3153899.html
總結(jié)
以上是生活随笔為你收集整理的转 UIAlertView 不显示、屏幕变灰的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: List中toArray()的使用方法
- 下一篇: 选择Asp for javascript