Q:

On iOS, why the init in ViewController didn't work?

In the ViewController's interface, I have
@property int count;

and in the implementation, I have
@synthesize count;

-(id) init {
    self = [super init];
    if (self) {
        self.count = 100;
    }
    return self;
}

-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    NSLog(@"%i", self.count++);
}

but for some reason, the first time self.count got printed, it is 0 but not 100?

A:

One of various -init methods will be called on your UIViewController, depending on whether it came out of a .xib, storyboard, or is alloc'd manually somewhere else in your code.
A better place to put this kind of initialization is in -viewDidLoad, something like this
- (void)viewDidLoad {
    [super viewDidLoad];
    self.count = 100;
}

