-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Description
I add email detection, url detection and userhandler detection on same label but its not working properly.
When i add chirag@y.com its take @y as a userhandler detection part and chirag & .com as a url detection part. So it's not detect chirag@y.com as email part.
NSString *emailRegexString = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
NSError *error;
NSRegularExpression *regex = [[NSRegularExpression alloc]initWithPattern:emailRegexString
options:0
error:&error];
PatternDescriptor *descriptor = [[PatternDescriptor alloc]initWithRegex:regex withSearchType:PatternSearchTypeAll
withPatternAttributes:@{NSForegroundColorAttributeName:[UIColor greenColor]}];
[self.postDetailsL enablePatternDetection:descriptor];
PatternTapResponder userHandleTapAction = ^(NSString *tappedString){
if ([self.delegate respondsToSelector:@selector(feedCell:didTapOnUserHandle:)]) {
[self.delegate feedCell:self didTapOnUserHandle:tappedString];
}
};
[self.postDetailsL enableUserHandleDetectionWithAttributes:@{NSForegroundColorAttributeName:[UIColor blueColor], RLTapResponderAttributeName:userHandleTapAction}];
PatternTapResponder URLTapAction = ^(NSString *tappedString){
if ([self.delegate respondsToSelector:@selector(feedNoMediaCell:didTapOnURLHandle:)]) {
[self.delegate feedNoMediaCell:self didTapOnURLHandle:tappedString];
}
};
[self.postDetailsL enableURLDetectionWithAttributes:@{NSForegroundColorAttributeName:[UIColor TARedesDisplayColor], NSUnderlineStyleAttributeName:[NSNumber numberWithInt:1], RLTapResponderAttributeName:URLTapAction}];
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels