开发者

UIWindow not getting set when pushing UIViewController from Nib

开发者 https://www.devze.com 2023-04-04 19:32 出处:网络
I\'m trying to do a very simple pushViewController with a view controller created from a nib. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

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

精彩评论

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

关注公众号