1

あるコントローラから別のコントローラに値を渡す方法は? ストーリーボードを使用しています。

-(void) prepareForSegue:(UIStoryboardPopoverSegue *)segue sender:(id)sender
{
    if ([segue.identifier hasPrefix:@"FinishController"]) {
        FinishController *asker = (FinishController *) segue.destinationViewController;
        asker.FinishDesc = @"What do you want your label to say?";
        asker.FinishTitle = @"Label text";
        asker.FinishPoint = @"asdas";
    }
}

絵コンテ

最初のビューの強調表示されたテキスト ビューに表示したいと思います。

コードの次のビューを呼び出すと、次のようになるはずです。 UIStoryboard *finish = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];

     UIViewController *viewController = [finish instantiateViewControllerWithIdentifier:@"FinishController"];

     viewController.modalPresentationStyle = UIModalPresentationPageSheet;
     [self presentModalViewController:viewController animated:YES];

仕上げコントローラー:

- (void)viewDidLoad
{
    self.lblFinishTitle.text=self.FinishTitle;
    self.lblFinishDesc.text = self.FinishDesc;
    self.lblFinishPoint.text=self.FinishPoint;
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}
4

1 に答える 1

0

グローバル変数の使用は可能ですか?もしそうなら、「extern」と呼ばれるものを見てください。これがあなたに方向性を与えることを願っています=]

于 2012-07-12T16:59:32.363 に答える