When using IB in conjunction with an additional view, you control the dragging and dropping of the element in IB into the .h file and create an output. You can drag it to one of two places, either inside the variable declaration block or outside the block.
If you drag it inside a variable block, you will get something like this:
@interface MyViewController : UIViewController { IBOutlet UIButton *foo; }
dragging it outside the block gives you something like ....
@interface ViewController : UIViewController { } @property (retain, nonatomic) IBOutlet UIButton *foo;
I thought about how different they are, and I'm a little confused. Well, I understand that the synthesized properties have some magic and create instance variables at run time (only at 64 bit / ARM). Therefore, I believe that I understand how 2 options work.
Which is the best option? The first option generates less code and seems simpler.
The second version offers publicly available accessors / mutators, but I rarely get access to exits from outside my class (and, if so, almost always with encapsulation). Since I started working with iOS, I have used this option exclusively.
Am I missing something or should I make the switch to variable base outputs in most cases?
source share