簡體   English   中英

如何從其他故事板場景中的主要故事板場景訪問變量?

[英]How to access variables from main storyboard scene in other storyboard scenes?

我正在開發一個具有3個故事板場景的應用程序。 在第一個情節提要面板場景中,我想在其他兩個場景中訪問一些變量。 我該怎么做? 我使用情節提要segue導航到其他兩個場景,並在單擊按鈕時調用以下內容

[self performSegueWithIdentifier:@"nameofsegue" sender:self];

使用這個方法

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([[segue identifier] isEqualToString:@"nameofsegue"]) {
        YourDestinationVC *dvc = [segue destinationViewController];
        YourSourceVC *svc = (YourSourceVC*)sender;
        //set your ivr here
    }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM