From 1d6b5dad8de1308fbafd0ca56c2d176dadf145ea Mon Sep 17 00:00:00 2001 From: GRMrGecko Date: Mon, 14 Feb 2011 05:51:33 -0600 Subject: [PATCH] Just because I noticed it break the tags to where it overflows, it now just uses the tag cleaner for finding out the link. Yes this can infact cause a problem if there is a span tag inside the link, but I am not to sure if I want to spend the time to detect inner tags. I think people won't mind if the link sometimes ends up being with the image. --- Classes/MGMAdinline.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Classes/MGMAdinline.m b/Classes/MGMAdinline.m index 5b7613f..bd74214 100644 --- a/Classes/MGMAdinline.m +++ b/Classes/MGMAdinline.m @@ -48,13 +48,13 @@ NSString * const MGMAIAllowStrangers = @"MGMAIAllowStrangers"; continue; range.location = linkStartRange.location+linkStartRange.length; range.length = [html length]-range.location; + NSRange linkReplaceEndRange = [html rangeOfString:@"<" options:NSCaseInsensitiveSearch range:range]; NSRange linkEndRange = [html rangeOfString:@"", link, shouldScroll]; - [html replaceCharactersInRange:linkRange withString:image]; - range.location += [image length]-linkRange.length; + NSRange replaceRange = NSMakeRange(linkStartRange.location+linkStartRange.length, linkReplaceEndRange.location-(linkStartRange.location+linkStartRange.length)); + [html replaceCharactersInRange:replaceRange withString:image]; + range.location += [image length]-replaceRange.length; range.length = [html length]-range.location; } [link release];