Effective way to design and manage iPhone application similar to settings?

I've become fond of implementing section controllers that pull the logic out of you UITableViewController subclass (or other hosting controller) and move them into self-contained classes I ended up implementing a base protocol that defines what a section controller needs to do - for me, that includes the number of rows in a section and a cell for the row (don't need the whole index path since the controller deals with a single section). I've got optional method for returning a section name and row height. That's all I've implemented so far since that's all I've actually needed It works for me because my individual sections tend to be homogeneous, but you could easily use the idea to return heterogeneous cells within the same section or refactor the idea to have cell type controllers instead of section controllers.In the end, my UITableViewDelegate and UITableViewDataSource methods just need to figure out which section controller to call instead of embedded all the logic within the UITableViewController subclass I think I got the idea from this article but I also saw a more recent article that describes the same idea.

I've become fond of implementing section controllers that pull the logic out of you UITableViewController subclass (or other hosting controller) and move them into self-contained classes. I ended up implementing a base protocol that defines what a section controller needs to do - for me, that includes the number of rows in a section and a cell for the row (don't need the whole index path since the controller deals with a single section). I've got optional method for returning a section name and row height.

That's all I've implemented so far since that's all I've actually needed. It works for me because my individual sections tend to be homogeneous, but you could easily use the idea to return heterogeneous cells within the same section or refactor the idea to have cell type controllers instead of section controllers. In the end, my UITableViewDelegate and UITableViewDataSource methods just need to figure out which section controller to call instead of embedded all the logic within the UITableViewController subclass.

I think I got the idea from this article, but I also saw a more recent article that describes the same idea.

You might want to look at coreyfloyds project github.com/coreyfloyd/Generic-Heterogene... I think this might have the functionality you need.

This is some decent code and an interesting take on how to manage an app like this. Unfortunately, it only really supports standard 'fields', like text input, radio selection lists, etc. My app does other much specific stuff, so I can't really use it. All I'm looking for is general tips for designing an infinitely extensible app which deals with an arbitrary number of rows displaying unrelated data in very different ways.

– David Foster Aug 10 '10 at 9:11.

Here's my suggestion - handle each cell as a member of the view. Lol, it's been a while since I've used a table, so I could just be talkin' crap here but give it a try. Instead of an enum use: NSThingyCell *nameRow; NSThingyCell *genderRow; @property IBOutlet NSThingyCell *nameRow; @property IBOutlet NSThingyCell *genderRow; - (IBAction) nameRowChanged:(id)sender; - (IBAction) genderRowChanged:(id)sender; and then instead of a table call with a switch, just wire each individual cell up in Interface Builder.

This has the added benefit of being row-independent, so if you have to put "ageRow" in between name and gender, nothing gets screwed up. This will also get pretty big, so if your view has several tables, you may want to consider splitting those tables out into separate nibs/controllers and loading the views at run-time.

You could also take a look at a similar question I had: stackoverflow. Com/questions/3343702/… – Stephen Furlani Aug 17 '10 at 12:18.

Interface settingsOption { NSString *key; UIView *displayElement; } + (settingsOption *)optionWithKey:(NSString *)key andDisplayElement:(UIView *)displayElement; @property (nonatomic, retain) UIView *displayElement; @property (nonatomic, retain) NSString *key; @end Where the class method would look like + (settingsOption *)optionWithKey:(NSString *)key andDisplayElement:(UIView *)displayElement; settingsOption *option = settingsOption alloc init; option. Key = key; option. DisplayElement = displayElement; return option autorelease; } Your settings class would have an array of settingsOption instances.

- (void)somewhereInMySettingsClass mySettings = NSMutableArray alloc init; mySettings addObject:settingsOption optionWithKey:@"age" andDisplayElement:UIButton buttonWithStyle:UIButtonStyleRect; mySettings addObject:...; } The table's cellForRowAtIndexPath would just do cell addSubview:mySettings objectAtIndex:indexPath. Row displayElement; You were talking about sections, though, which would add another layer to the data. This might simply be a matter of splitting mySettings into an array of arrays instead, where each array in the array is one section.

Not sure if I missed anything above. Feel free to point and poke. You might simplify the settingsOption class further by adding more helper classes for various types of elements, e.g. + (settingsOption *)buttonWithKey:(NSString *)key; + (settingsOption *)switchWithKey:(NSString *)key; + (settingsOption *)pickerWithKey:(NSString *)key withDataSource:(id )source withDelegate:(id )delegate; etc etc.

I would just like to clarify that by 'design', I mean software design, not UI design. I have an application similar to the native settings app. The problem I have with it is it doesn't follow the same clear-cut MVC style.

Other apps tend to focus around displaying one kind of thing.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions