views:

40

answers:

2

I'd like to have a settings view in my app. I want to have things like UILabels, UISwitches etc. (Like in the Settings app.)

How can I go about doing that? Can I just replace the detailView with the required view, or is there more to it then that? That may not work because I need to be able to set and get text values too.

+1  A: 

Take a look at this project.

If you want to do it yourself, you can e.g. attach your own views to the cell's contentView, or use the accessory view to display your switches etc.

Joseph Tura
90% of the settings app can be constructed using just the accessory view. and built-in table cell types.
Ed Marty
A: 

You just add your custom views as subviews to the cells content view. Heres an example with an image view:

UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 30, 30)];
imageView.image = [UIImage imageNamed:@"SomeImage.png"];
[cell.contentView addSubview:imageView];
Sorig