Am working for am message based iPhone app. In my application i have loaded the message content in UITextView and added an UIImage on UITextView.
Now i want to select all UITextView content by holding UITextView and show the Copy option to the user. Currently when the user hold UITextView some of the content only selecting
.
Any one please help me to do this? Thanks in advance.
EDIT:
In UITableView CellForRowAtIndexPath
delegate
customMessageTextView = [[MessageTextView alloc] initWithFrame:CGRectZero];
customMessageTextView.tag = 100;
UIFont *font = [UIFont fontWithName:@"Helvetica" size:15];
customMessageTextView.font = font;
customMessageTextView.scrollEnabled = NO;
customMessageTextView.delegate = self;
customMessageTextView.dataDetectorTypes = UIDataDetectorTypeLink;
[cell.contentView addSubview:customMessageTextView];
[customMessageTextView sizeToFit];
for (UIGestureRecognizer *recognizer in customMessageTextView.gestureRecognizers)
{
if ([recognizer isKindOfClass:[UILongPressGestureRecognizer class]])
{
recognizer.enabled = NO;
}
}
UILongPressGestureRecognizer *myLongPressRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(selectAllTextFromCustomMessageTextView)];
[customMessageTextView addGestureRecognizer:myLongPressRecognizer];
[myLongPressRecognizer release];
UILongPressGestureRecognizer action:
-(void) selectAllTextFromCustomMessageTextView
{
NSLog(@"Select All Text Messages");
customMessageTextView.selectedRange = NSMakeRange(0, customMessageTextView.text.length);
}