2012-06-12 35 views
3

在IOS alertview我有20%的符號如何刪除這個..如何alertview IOS刪除%20

enter image description here

這是我的代碼

NSString *titile = result; 
NSString *notifiText=txtresult; 

alertView = [[UIAlertView alloc]initWithTitle:title message:notifiText delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok", nil, nil]; 
       [alertView show] 

我只是想喜歡輸出這個而不是%20我想要空間..

+0

可以在這裏發佈** notifiText **文字。併發布你想要的輸出 – iLearner

+0

我的意思是說發佈**「txtresult」**,意味着你想要在警報視圖中顯示的字符串。 – iLearner

回答

11

由於您很可能從網絡或JSON/XML響應中檢索警報文本,字符串會以「百分比逃脫」。您需要在顯示警報之前將其刪除。

幸運的是,NSString有一個方便的方法,名爲stringByReplacingPercentEscapesUsingEncoding(我已經鏈接了Apple的文檔)。

+0

+1不錯,打敗我吧! – WrightsCS

+0

是的,很好的+1給你思考和我一樣的思路。 –

+0

+1爲您的快速幫助.. –