I'm looking开发者_StackOverflow to make a view similar to Apple's "Settings" application. Example: http://www.amitbhawani.com/apple/Images/I/iphone-MMS-Settings.jpg
How can I set up my application to look/work like that?
You'll need to use a UITableView with the style set to UITableViewStyleGrouped for the appearance. For editable fields you should be able to add UITextField views to the contentView property of the tableView cells.
That's just a grouped tableview, with section headers.
Like others have said, you want to make use a UITableView with grouped styles. In your
- (void) viewDidLoad
method, add the following line of code:
[self.tableView initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.framw.size.height) style: UITableViewStyleGrouped];
It should give you the appropriate style.
I would say that you should add switches and text fields as accessoryViews, not contentViews, though.
See the Documentation for more on customizing UITableView.
Also, see my question here, the answers there may be helpful: Custom UITableViewCell for Settings-like application?
精彩评论