2012-06-12 38 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为您的快速帮助.. –