0

I used to initialize my UIViewController in - (void) viewDidLoad.

Since the update to iOS 7 the viewDidLoad method is either not called or after executing setItemAndParents.

Example:

I have a UITableViewController if you click on a cell the desired view is loaded:

- (void)tableView: (UITableView *)tableView didSelectRowAtIndexPath: (NSIndexPath *)indexPath {
    // some more code
    [cpvc setItemAndParents:items[selectedIndex] orderIndex:indexOrder];
}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    cpvc = segue.destinationViewController;
}

Where am I supposed to initialize the ViewController.

Remember with iOS 6 everything worked find.

Thorsten Niehues
  • 13,712
  • 22
  • 78
  • 113

2 Answers2

1

Had similar problem.

I inserted this right after allocation of viewController (or in some case after pushViewController):

viewController.view.hidden = NO;

and it calls viewDidLoad.

Hope I helped.

Milena
  • 61
  • 5
  • This is working because as soon as you ask for 'view' property, the controller loads it and viewDidLoad is called – ipodishima Dec 10 '13 at 20:14
0

Yup it happens to me also... You can initialized view controller in - (void)awakeFromNib{} method. This method help me in the same scenario as you have.

Adnan Aftab
  • 14,377
  • 4
  • 45
  • 54