how to create a page to display information like About on iPhone with some fields have Disclosure indicator?
i would like to know how to build a screen that look开发者_运维百科s exactly like the About screen on iPhone.
I would like to display information in such format.. its so clean..
any ideas?
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.
精彩评论