views:

54

answers:

1

I do start off organising my .h files with the best intentions but somehow they get disgustingly messy.

Below is an example (which isn't that bad, but i've seen much worse!). I've tried grouping sections with #pragma mark but it seems to look even messier.

All the UILabels and UIButtons are required (as mentioned above) as they're showing data coming from a web service request so they're all required if we're using Interface Builder to design our GUI's. For example, the label might be a "weight" or "height" characteristic for a product.

Does anyone have any good advice on how to organise these in the most maintainable/readable way?

Cheers

alt text

+3  A: 

It strikes me as possible that you have too many properties, there. I've quite literally never seen any class with this many outlets; why are you addressing every single element in your layout? And why all from one controller?

It seems as if the best solution to your problem is to consider your class and split it up into multiple classes; each controlling one aspect of your interface. You also need to make sure that you really need to address all these elements. (The UILabels and UIButtons in particular seem like strange things to have outlets for.)

Williham Totland
Hi Williham, thanks for your response! All the UILabels and UIButtons are required (as mentioned above) as they're showing data coming from a web service request, so they're all required if we're using Interface Builder to design our GUI's. For example, the label might be a "weight" or "height" characteristic for a product. While the buttons push to another view to show further data about the product.
Jamie Chapman
Then you have no recourse but to split the class up into several, specialized classes. If this is as small as it goes, of course; it's as small as it goes, and there's not really anything to be done for it.
Williham Totland
Instead of using a UIScrollView containing labels with buttons that provide navigation, why not just use an instance of UITableView where the cells contain the text currently used to populate the labels, and then navigate when the user touches a row?
jlehr
@jlehr Thanks :-) We would normally do that under normal circumstances, but it was easier within the time constraints given the clients (awful) artwork.
Jamie Chapman