If you like to implement dataDetectorType in the message body, it does not exist. The only way is to subclass UIAlertView and configure the init method as follows:
- (id)initWithTitle:(NSString *)title message:(NSString *)message delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ... {
self = [super initWithTitle:title message:nil delegate:delegate cancelButtonTitle:cancelButtonTitle otherButtonTitles:otherButtonTitles, nil];
if (self) {
CGRect alertFrame = [self frame];
UITextView myTextView = [[UITextView alloc] initWithFrame:CGRectMake(alertFrame.origin.x + 10, alertFrame.origin.y + 44, 200, 44)];
[myTextView setEditable:NO];
[myTextView setBackgroundColor:[UIColor clearColor]];
[myTextView setDataDetectorTypes:UIDataDetectorTypeAll];
[myTextView setText:@"http://www.apple.com"];
[self addSubview:myTextView];
[myTextView release]
}
return self;
}
I tested it right now and it works, but you need to spend a bit to make it presentable: P
Perhaps using the method posted by Jhaliya is quick and clean.
source
share