iphone 2.x sdk - 引用另一个viewController里面显示为空的视图控制器

问题描述:

我想给一个自定义选择器视图控制器的新创建的实例引用另一个viewController像这样(这是一个选择器从ponceViewController实例的tableView行被窃听后调用)...iphone 2.x sdk - 引用另一个viewController里面显示为空的视图控制器


- (IBAction)rowTapped:(id)sender { 
    TimerPickerViewController *viewController = [[TimerPickerViewController alloc] initWithNibName:@"TimerPickerView" bundle:nil] 
    self.timerPickerViewController = viewController; 
    timerPickerViewController.ponceViewController = self.rootViewController; 
    [viewController release]; 
} 

然后我timerPickerViewController实例内,我有:

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { 
    ... 
    // ponceViewController is null here 
    ... 
    } 
}

的timerPickerViewController显示就好了,我可以连访问从ponceView的东西控制器后,我点击我的“完成”按钮,但我合成ponceViewController,它在我的头和一切,我似乎无法访问它在timerPickerViewController的initWithNibName方法 - 它总是空的。 :(任何人有任何想法

编辑:?我还要提到的是ponceViewController为空timerPickerViewController的viewDidLoad方法中,以及...

- (void)viewDidLoad { 
    ... no such thing as ponceViewController here! ... 
}

所以我固定它通过完全从timerPickerViewController去除initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil和使用viewDidLoad相反,一切似乎工作正常,我认为问题是,该物业是不可用的时候引用它initWithNibName内,希望可以帮助别人