Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to select all UITextview content by hold and show Copy option by programmatically iphone?
    primarykey
    data
    text
    <p>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. </p> <p>Now i want to <strong>select all UITextView content by holding</strong> UITextView and <strong>show the Copy option</strong> to the user. Currently when the user <code>hold UITextView some of the content only selecting</code>. </p> <p>Any one please help me to do this? Thanks in advance.</p> <p><strong>EDIT:</strong></p> <p>In UITableView <code>CellForRowAtIndexPath</code> delegate</p> <pre><code> 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]; </code></pre> <p>UILongPressGestureRecognizer action:</p> <pre><code>-(void) selectAllTextFromCustomMessageTextView { NSLog(@"Select All Text Messages"); customMessageTextView.selectedRange = NSMakeRange(0, customMessageTextView.text.length); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload