iphone - 如何在 alertview ios 中删除 %20

标签 iphone ios uiwebview uialertview

在 ios alertview 中我有 %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 我想要空间..

最佳答案

由于您可能会从 Web 或 JSON/XML 响应中检索警报文本,因此该字符串以“百分比转义”编码。您需要在显示警报之前删除它们。

幸运的是,NSString 有一个方便的方法,名为 stringByReplacingPercentEscapesUsingEncoding (我已经链接了 Apple 的文档)。

关于iphone - 如何在 alertview ios 中删除 %20,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10990717/

相关文章:

ios - 核心蓝牙功能

iphone - 找不到豹中的 libxml2?

iphone - UIWebView 中如何处理图像

ios - 网页内容在 UIWebView 中被截断

javascript - 获取 HTML 元素 - Obj-c

iphone - iOS Oblique TextView 在 Cocos2D 或 native 中滚动

iphone - 如何隐藏 iOS 数字键盘

iphone - UIWebView:为什么使用不存在的主机名时请求不会超时?

ios - UITableView 内容中的空间

iphone - 在手机上使用 CSS 技巧全宽