Copy/Paste functionality in UITableViewController.

Posted by Simon on Stack Overflow See other posts from Stack Overflow or by Simon
Published on 2011-01-03T04:49:31Z Indexed on 2011/01/03 4:53 UTC
Read the original article Hit count: 230

Filed under:

Hi.. I have a UITableViewController. I want to pop the copy/paste menu up when the user touches a cell. How to implement this functionality. Can someone help me.

I tried this code,

UIMenuController *theMenu = [UIMenuController sharedMenuController];
[theMenu setTargetRect:CGRectMake(10, 200, 100, 40) inView:[self tableView]];
[theMenu setMenuVisible:YES animated:YES];

But it doesn't work. My question is,

  1. What CGRect I have to pass as the setTargetRect parameter?
  2. Do I need to call SetNeedsDisplayInRect in my TableViewController?
  3. What else to do to make this work?

© Stack Overflow or respective owner

Related posts about iphone