I'm getting comfortable with iOS and Objective-C programming, but where instance variables are declared is still a confusing point for me.
- Most of the time they seem to be declared in the class' .h file, as part of the interface.
- Other times, they are declared in the .m file's interface.
Another way I've seen is when they're declared in the .h file, but in a "separate division" of the interface, for lack of a better term, like so:
@interface MapViewController : UIViewController { UIPopoverController *popoverController; } ....
Where is the correct way to put them? Is it entirely subjective? I've got the impression that for instance variables that other classes will need to access, put them as a main property in the .h file, but for variables that only the class needs to access class-wide, put them in the .m's interface. Then the special division of .h confuses me all together.
Could someone shed some light on this?