开发者

Problem space in UIWebView

In practice I have a button that sends the request to a URL to a UIWebView eg: tel:124324 4563, but unfortunately it does not load the page because there is a space. How do I remove the space? as happens in Mobile Safari that I开发者_开发技巧 replace it with %20?

Thanks


The easiest way is:

[string stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]

As documented here.


- (NSString *)stringByAddingPercentEscapesUsingEncoding:(NSStringEncoding)encoding

You can use [myString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜