darxmac
darxmac

Reputation: 21

Strange behaviour with UITableViewController and UITextFields

I'm observing some strange behaviour when working with a UITableViewController and UITextFields in the cells.

The UITextFields delegate is set to the UITableViewController and when entering editing mode the tableview scrolls to the relevant cell, and does not obscure the input with the keyboard.

However, when I present another view controller using

[self presentViewController:vc animated:TRUE  completion:^() {}];

And later dismiss it with

[self dismissViewControllerAnimated:YES completion:^{}];

The table stops scrolling and resizing to fit the keyboard.

It does not seem to matter where I call the presentViewController method (in the cell, in the headers or in a toolbar)

Any ideas?

UPDATE 1:

Delegate for my UITextField is set in - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath with cell.textField.delegate = self

I only override viewWillAppear:(BOOL)animated:

- (void) viewWillAppear:(BOOL)animated  {
    [super viewWillAppear:animated];
    [[GAI sharedInstance].defaultTracker sendView:@"Some view name"];
}

UPDATE 2

Manually calling

[self dismissViewControllerAnimated:YES completion:^{
        [self viewWillAppear:YES];
}];

Fixes it, but i'd still like some input to why this is necessary ?

Upvotes: 1

Views: 351

Answers (1)

darxmac
darxmac

Reputation: 21

Somewhere in the view hierarchy I had missed a call to [super viewWillAppear:].

Upvotes: 1

Related Questions