0

我正在使用 Facebook API,当用户选择一个地方(CheckIn)时,我想打开另一个视图并传递这个地方(FBGraphPlace),但是在“SecondViewController”中,当方法“viewDidLoad”被执行时,变量为空. 当用户选择地点时:

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];
4

1 回答 1

0

你应该先做 pushViewController,然后分配 place 变量

于 2013-02-14T01:07:07.343 回答