A---》B
想把數據 NSString A_data 從AController傳到BController,則在BController中 @property 一個NSString data ,然后在AController中添加方法
- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
UIViewController *destination = segue.destinationViewController;
if ([destination respondsToSelector:@selector(setData:)]) {
[destination setValue:A_data forKey:@"data"];
}
}