StoryBoard頁面聯線跳轉已經頁面之間傳參數

 

1.選中上圖黃色。按住Control 把線拖到要要跳轉的頁面,尋找show。ide

2.選中聯線。在右邊Identifier:隨便填入一個標示atom

3.在按鈕點擊事件加上以下代碼spa

- (IBAction)buttonTouched:(id)sender {orm

    [self performSegueWithIdentifier:@"ViewDetail" sender:self];blog

}事件

4. StroryBoard中 A 頁面把值傳到B頁面it

B 頁面 h文件io

@property (copy, nonatomic) NSString *str;form

 

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {class

    [super prepareForSegue:segue sender:sender];

    if ([segue.identifier isEqualToString:@"ViewDetail"]) {

        DetailViewController *detailVC = segue.destinationViewController;

        detailVC.str = @"dddd";  // 傳值

    }

}

相關文章
相關標籤/搜索