UITableViewCell with “copy” ability
- March 18th, 2010
- Posted in Uncategorized
- Write comment
I am working on an app with core data and I wanted to be able to tap and hold the cell so I could copy the data just like you are able to in the Contacts app.
I Googled this, searched most of the sites I visit and saw that many people have run up against this too. I searched the iPhone Developers site too and after several days of searching, I had all but given up. Then I accidentally typed in “UITableViewCell copy paste” instead of “UITableViewCell select, copy and paste” like I had been, and BINGO! I found the info and code I needed by Hans Pinckaers.
Here is what he has on his blog:
“It’s possible to copy the content of a UITableViewCell in the Contacts app of Apple. When you tap and hold you will see a small menu with “Copy”. I needed this functionality myself, so I subclassed the class. You are free to use this in any application, but it would be awesome if you mention me in the credits of your App.”
It’s easy to use
Copy the files in your project.
Use this code to create a cell:
cell = [[[HPCopyTableViewCell alloc]
initWithStyle:UITableViewCellStyleValue2
reuseIdentifier:CellIdentifier] autorelease];
I will tell you, it works perfect. I don’t see any private api call, so it should be fine to use. Look it over and give it a shot. I give a shout out to Hans and thanks for sharing this with all of us!
Check out his site for the files and more. www.hanspinckaers.com

Everett, WA
Keep posting stuff like this i really like it