views:

24

answers:

1

i would like to know how to build a screen that looks exactly like the About screen on iPhone.

I would like to display information in such format.. its so clean..

any ideas?

+2  A: 

Erm all it is is a grouped type UITableView which is pretty easy to create. Create it in Interface Builder and choose "Grouped" as the Type & connect it up with your class or create it programatically:

Example:

UITableView * myTable = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 465) style:UITableViewStyleGrouped];

        [myTable setDelegate:self];

        [myTable setDataSource:self];

        [controllerView addSubview:myTable];

        [myTable reloadData];

        [myTable release];

Then, you'll need to define the .accessoryView property in - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath. Let's for example create a switch as the cells accessoryView:

  cell.textLabel.text = @"Donation Reminder"; 
  UISwitch*donationSwitch = [[[UISwitch alloc] initWithFrame:CGRectMake(0, 0, 50, 27)] autorelease];
  cell.accessoryView = donationSwitch;

and voila, the switch will be its subview. If you just want text, like in your question, just create a UILabel as I created the Switch.

David Schiefer
icic.. cool.. i will try it out.. i never knew that we could add UI components to AccessoryView... i have another question.. how do i control some cell to be selectable and some cell not selectable?
Yit Ming
i think there is a `isSelectable` property for cell accessory views. If you want the actual cells not to be selectable, you'll have to implement it in the "didSelectRow" method.
David Schiefer