我正在使用Facebook API,当用户选择一个地方(CheckIn)时,我想打开另一个视图并传递这个地方(FBGraphPlace),但是在“SecondViewController”中,当方法“viewDidLoad”时该变量为null “被执行了。 当用户选择地点时:
if (secondViewController == nil)
{
SecondViewcontroller *secondViewcontroller =
[[SecondViewcontroller alloc]
initWithNibName:NSStringFromClass([SecondViewcontroller class])
bundle:[NSBundle mainBundle]];
self.secondViewcontroller = secondViewcontroller;
}
// How you reference your navigation controller will
// probably be a little different
UIBarButtonItem *newBackButton = [[UIBarButtonItem alloc] initWithTitle: @"Back" style: UIBarButtonItemStyleBordered target: nil action: nil];
[[self navigationItem] setBackBarButtonItem: newBackButton];
secondViewController.place = self.selectedPlace;
[self.navigationController
pushViewController:self.secondViewcontroller
animated:YES];
答案 0 :(得分:0)
首先应该执行pushViewController,然后分配位置变量