2

I have created a Table View that has multiple Table View Cells of different styles - say "CellStyle1" and "CellStyle2".

The cells look different, but they should perform the same when selected - namely, segueing to the same new view.

I have set up both cells to have the same Storyboard Segue - "PushView", pointing to the same view controller.

This seems to work OK, but Xcode generates a warning: "Multiple segues with identifier"

How can I avoid this error? What is the right way to handle multiple custom cells that look differently but act the same and should segue to the same place?

This one has me scratching my head.

Thanks!

4

1 回答 1

4

您可以通过 ctrl 从视图控制器拖动到目标视图控制器来制作一个 segue。然后假设点击单元格是您想要触发 segue 的事件,在 didSelectRowAtIndexPath 调用 performSegueWithIdentifier。

- (void)performSegueWithIdentifier:(NSString *)identifier sender:(id)sender

或者只是给 2 segues 不同的标识符,并在 prepereForSegue 检查任一标识符。

于 2011-12-19T01:08:01.197 回答