Your view is animating as you have asked it to by wrapping the [self.view layoutIfNeeded]
call inside an animation block.
In viewDidLoad
you begin observing keyboard changes, and when you detect them you animate the adjustments, this is normally correct. But then, before the view does its first layout, you show the keyboard; this results in an animation for all the views from CGRectZero
to their proper sizes. And this is the effect you are seeing.
So basically you need to give the view a chance to layout before your animated layoutIfNeeded
call. Probably the easiest way to do this is simply to move [self.textView becomeFirstResponder];
to either viewWillAppear:
or viewDidAppear:
.
*As a side note, remember to call super in appearance calls. I noticed you did not call [super viewWillDisappear];
.