What's the normal way of organising a header file in Objective-C?

120 views Asked by At

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

1

There are 1 answers

4
Williham Totland On BEST ANSWER

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.)