首页 > 其他 > 详细

storyboard有多个Segue的传递

时间:2014-11-05 12:10:23      阅读:266      评论:0      收藏:0      [点我收藏+]

在项目中需要在一个页面向多个页面传不同的值。

在view2Controller和view3Controller中分别有相应的Str2和Str3

 1 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
 2 {
 3     
 4     NSString *view2 = @"goToView2";
 5     NSString *view3 = @"goToView3";
 6     
 7     if ([[segue identifier] isEqual:view2]) { //通过[segue identifier] 得到指向那个页面
 8         
 9         UIViewController *send = segue.destinationViewController;
10         
11         if ([send respondsToSelector:@selector(setStr2:)]) {
12             
13             [send setValue:@"view2" forKey:@"Str2"];
14             
15         }
16     }else if([[segue identifier] isEqual:view3]){
17         
18         UIViewController *send = segue.destinationViewController;
19         
20         if ([send respondsToSelector:@selector(setStr3:)]) {
21             
22             [send setValue:@"view3" forKey:@"Str3"];
23             
24         }
25     }else{
26         NSLog(@"nothing");
27     }
28 }

 

storyboard有多个Segue的传递

原文:http://www.cnblogs.com/ngi8/p/4075740.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!