开发者

UIWindow not getting set when pushing UIViewController from Nib

I'm trying to do a very simple pushViewController with a view controller created from a nib.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
ServiceDetailViewController *serviceDetail = [[ServiceDetailViewController alloc] initWithNibName:@"ServiceDetailViewController" bundle:nil];
serviceDetail.employee = _employee;

[self.navigationController pushViewController:serviceDetail animated:YES];
previousSelectedRow = indexPath;
}

If I return the window of the serviceDetail view controller within its viewDidLoad or anywhere else inside of its functions it is null. When I return its window right aft开发者_JAVA百科er pushViewController it is fine.

My viewDidLoad is normal. I am calling super.

It seems like this is either something silly that I'm overlooking, a problem with my splitViewController setup, or a bug in xCode 4/ARC.

I understand I may need to provide a lot more code but I'm hoping someone might have an idea.


viewDidLoad is called right after a view is loaded into memory, but before the view is added to the view hierarchy including the backing window. The viewDidAppear method is called right after being added to a window. Maybe your code needing the window value will work better in that method.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜