Why must I define variables twice in the header file? What differences are there between these variables?
The first definition is here:
@interface MyCont
In modern runtime you do NOT need to declare them twice. Just use:
In you .h
@property (nonatomic) NSInteger selectedIndex;
The part between the {} is the declaration of the iVar. And with your @property you declare getter and setters. In modern runtime if you just use the code above you say basicly the same (your iVar is now _selectedIndex).