1
eyeplum 2012-12-07 10:40:44 +08:00
TestViewController *vc = [[TestViewController alloc] init];
vc.needValue = buttonIndex; 这里赋值不是这么赋的。你要找到 Segue 的实例 vc,而不是自己 init 一个。 // Get reference to the destination view controller TestViewController *vc = [segue destinationViewController]; // Pass any objects to the view controller here, like... vc.needValue = buttonIndex; 看这里:http://stackoverflow.com/questions/7864371/ios5-how-to-pass-prepareforsegue-an-object |
2
eyeplum 2012-12-07 10:58:10 +08:00 1
补充:如果你想要 actionSheet:clickedButtonAtIndex: 方法里的 buttonIndex 参数,我个人的做法是新建一个 property,比如 self.buttonIndexTapped 然后:
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { // ... 其他代码 self.buttonIndexTapped = buttonIndex; // ... 其他代码 } |
4
zhigang1992 2012-12-07 17:29:12 +08:00 1
[self performSegueWithIdentifier:@"aIdentifier" sender:theActionSheet];
然后, prepareForSegue:sender里面就可以取道actionSheet的值了。 |