Last active
December 15, 2015 16:29
-
-
Save lxcid/5289553 to your computer and use it in GitHub Desktop.
Solution for http://pastebin.com/ANhr7BMr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)modifySelectedString: (NSDictionary *)theAttribute { | |
NSString *mainString = [self.mainStringLabel.attributedText string]; | |
NSString *queryString = [self selectStringFromMainStringLabelViaStepper]; | |
NSRange selectedStringRange = NSMakeRange(0, mainString.length); | |
while (selectedStringRange.location != NSNotFound) { | |
NSRange selectedStringRange = [mainString rangeOfString:queryString options:0 range:selectedStringRange]; | |
if (selectedStringRange.location != NSNotFound) { | |
[self addAttributeWithRangeToSelectedString:theAttribute range:selectedStringRange]; | |
NSInteger nextIndex = selectedStringRange.location + selectedStringRange.length + 1; | |
selectedStringRange = NSMakeRange(nextIndex, mainString.length - nextIndex); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment