Fernando Reynoso
Fernando Reynoso

Reputation: 545

UITableViewController and ViewWillAppear issue

In my iOS app I have a UITableViewController with some custom cells containing UITextView each one.
The reason I decided to use the UITableViewController instead of a normal UIViewController was because I wanted to automatically move up the view when the keyboard appear and it was working great at the beginning but when I needed to override the -viewWillAppear method it stopped working. Does anyone knows how to fix this issue? Or can anyone explain to me why this is happening?

Upvotes: 0

Views: 254

Answers (2)

Petro Korienev
Petro Korienev

Reputation: 4027

Didn't you forget to call [super viewWillAppear:animated] in viewWillAppear: ? Most likely UITableViewController subscribes to keyboard notifications in viewWillAppear: and unsubscribes in viewWillDisappear:

Upvotes: 4

Shahab Qureshi
Shahab Qureshi

Reputation: 950

must call

-(void)viewWillAppear:(BOOL)animated {

    [super viewWillAppear:animated];
}

Most likely UITableViewController subscribes to keyboard notifications in viewWillAppear: and unsubscribes in viewWillDisappear:

Upvotes: 1

Related Questions