To allow user interaction with links I use code like this:
UITextView *t1 = [UITextView new];
[self.view addSubview:t1];
t1.frame = self.view.frame;
t1.font = [UIFont systemFontOfSize:16];
t1.text = @"go to http://apple.com";
t1.dataDetectorTypes = UIDataDetectorTypeLink;
t1.editable = NO;
But if I need to set new text, it reuse style:
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
t1.text = @"test";
});
Will show "test" like link (blue color) but without link behaviour (go to link, context menu). I didn't find in documentation why this is legal.
As I understand the only way to "fix" this is reset attributes like font, text color to initial values.