views:

981

answers:

5

Hi!

I would like to build a table that looks almost exactly as the one in the iPhone's contacts app. When you click on a contact it shows the information related. The biggest problem comes when I try to build that: a table with complex cells, with transparent cells and cell with two buttons.

How would you do that?

Thanks!

+3  A: 

You'll want to study the Table View Programming Guide, which will walk you through the various pieces of this. Along with that, you should study the sample code in TableViewSuite. This sample code includes a series of five examples of increasing complexity.

I'm not certain what you mean by "transparent cells" however. There aren't any transparent cells in Contacts. What you are probably referring to is called a grouped table, and you will learn about that in the Programming Guide.

Rob Napier
I'm talking about the grouped tables. When I say "transparent cells" I mean that you can see the content (some labels and or buttons) but the white background is gone and you can see a grey background with white stripes.
You're on the right track then. The Programming Guide should tell you all you need to know, and the sample code will give you some practical examples. Let us know if you run into specific issues.
Rob Napier
A: 

I suggest you review the article on Cocoa with Love on drawing custom UITableViewCells as a starting point.

Roger Nolan
A: 

If the "transparent cell" you are referring to is the top section of the Contact Info page that displays the contact's picture and name, then this tutorial might help you. It is possible to insert custom header and footer views above and below each section of a table. That tutorial details how to add a header view to the first table section to display a picture and a label just like in the Contacts app.

Tim Isganitis
A: 

I've written a tutorial on how to Create Unique Looking Table with Custom Cells that might be of some help.

John

iPhoneDevTips

John
A: 

I tried your code it could not work. I tried mine it worked but there still bugs. the text will not be wiped out according to my desire. if (sender == songMenuButton) { [mainAppDelegate xitiWithS2:7 p:@"Favoris_Liste_Titres"]; [artistBackButton setHidden:YES]; [songBackButton setHidden:(0==songBackButtonToClick)]; selectedMenuIndex = 2; if ( [mainDataCenter.favoriteSongArray count] == 0) { [label setHidden:YES];

} else
{ [label setTextColor:[UIColor whiteColor]]; [label setText:@"AUCUN FAVORI TITRE"]; //@"AUCUN FAVORI TITRE"]; }

}

this is for one button I have total 3 buttons in the favorite menu after i click other button and click back again, the text disappear but also disappear on other buttons too even though nothing in there,( it is supposed to print the text when there is nothing). - (void)tableView:(UITableView*)tv commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath*)indexPath { // If row is deleted, remove it from the list. if (UITableViewCellEditingStyleDelete == editingStyle) { Metadata *aData = [mainDataCenter.favoriteSongArray objectAtIndex:indexPath.row]; [mainDataCenter removeSongFromFavorite:aData]; // Animate the deletion from the table. [tv deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
} This is how i remove the items

Rocker