We can declare like this for IBOutlet. Can I know what is the difference/advantages between 1 and 2 declaring method style?
@interface CurrentJobDetailsVC ()
{
IBOutlet UISegmentedControl *segControl; // -> 1
}
@property (weak, nonatomic) IBOutlet UISegmentedControl *segControl; // -> 2
@end
This is globally the same expect 2 differences:
1 - Declare an iVar.
IBOutlet UISegmentedControl *segControl;
is equivalent to __strong IBOutlet UISegmentedControl *segControl;
[segControl someMethod]
.2 - Declare it as a property
self.segControl
and you can use it like [self.segControl someMethod]
[_segControl someMethod]