现在的位置: 首页 > 综合 > 正文

使用StoryBoard:用Segue传递数据

2013年03月08日 ⁄ 综合 ⁄ 共 339字 ⁄ 字号 评论关闭

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"];
}

}

抱歉!评论已关闭.