views:

465

answers:

3

I was curious if anybody knew the process to create an "add photo" image tile similar to that in the iPhone contacts app. It seems to be on the same level as a UITableViewCell which is shortened (if this is the way it is done).

I've read a suggestion dealing with Headers or custom UITableViewCells but nothing definitive on how it was done. Any illustrative code snippets would be most welcome.

Thank you for any replies.

+1  A: 

It's just a UIButton added to a UITableViewCell. You can simply use the addSubview method of the UITableViewCell to add a button to the cell.

mjdth
Thank you for the answer but this doesn't seem likely from the appearance of the "add image" part of the app (the table view cell appears to be separate from the "add image" part).
Urizen
You can modify the `UITableViewCell` and the background view to make it appear as if it were only the item on the right. Sort of like how when you go into edit mode it automatically resizes the visible view of the cell, you can do that and then add the button to the left of the cell.
mjdth
Thanks mjdth. Do you have the link to any code samples for carrying this out? I'm a begginer to Objective-C so any illustrative code sample would be very helpful.
Urizen
That "button" is not a `UIButton`. It is an `ABPersonImageView` (http://ericasadun.com/iPhoneDocs/_a_b_person_image_view_8h-source.html).
KennyTM
A: 

It is a header. Most of the functionality is in the 'HeaderFooter' example from the apple developer site. In that example they use a UIImageView for the photo area, but you can implement it with a UIButton instead. If you do this, just set the text to 'Add Photo' when desired, with a blue bold font of about size 12. If you want to leave it as an imageView, you'll have to put a subview with the text on top of it.

blindJesse
Sorry. I meant the view that shows a rounded square for the image then a space followed by what looks like a UITableViewCell that is approximately 3/4 of the size of the other grouped UITableViewCells.You seem to be describing the header at the top of the detail view for the contacts.
Urizen
I understand your dilemma now. That does look like an indented cell.
blindJesse
A: 

The name part can easily be recreated with a UIButton with a PNG image of a detail disclosure icon set as the button Image. It really looks like a small UITabelViewCell.

If you really want you can use a tiny UITableViewCell instead of the PNG for to render the detail disclosure icon, but that's a heavier, more kludgy solution.

William Denniss