I added MSTextView in my project. It is working fine in every manner except some of the links e.g. http://www.t-mobileadvantagedirect.com/L.aspx?d=Vb4UseqIl9QYojIAqfjNqw==. I am not having any idea of link regex. Please help me...I finished my whole app, only this issue is bothering me..
2 Answers
In line 190 of MSTextView.m
, return the following instead:
return @"(\\bhttps?:\\/\\/[-A-Z0-9+&@#\\/%?=~_|!:,.;]*[-A-Z0-9+&@#\\/%=~_|])";
You also need to specify the NSRegularExpressionCaseInsensitive
option when creating the NSRegularExpression
object.
Also, be a good person, fork the repository, make the changes in your fork and submit a pull request to the original author.
Source of the regular expression: https://stackoverflow.com/a/8943487/350272
I've no idea with the MSTextView, but I can help you! I believe that you've all URLs like in question, and it's not showing up with the textview, right?
What you've to do is,
Show normal url inside your text with MSTextView, something like,
Check out my website, here's the link, http://www.t-mobileadvantagedirect.com
okay, now in, MSTextView
delegate,
You've to check for the URL tapped,
- (void) handleURL:(NSURL*)url
{
if([url.absoluteString isEqualToString:@"http://www.t-mobileadvantagedirect.com"])
{
WebViewController *webview = [[WebViewController alloc] initWithURL:[NSURL urlWithString:@"http://www.t-mobileadvantagedirect.com/L.aspx?d=Vb4UseqIl9QYojIAqfjNqw=="]];
[self.navigationController pushViewController:webview animated:YES];
[webview release];
}
}
I know this isn't a solution if you've the same domain url for multiple paths!
-
-1. This is an incredibly dirty workaround that makes a lot of assumptions. It's much easier to fix the actual problem itself. – JustSid Aug 09 '13 at 13:10
-
@JustSid, Yes! you're absolutely right. That's why I written I am not really aware of the things used, this can be a trick to overcome the problem. :) – Hemang Aug 09 '13 at 13:20