Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
360 views
in Technique[技术] by (71.8m points)

ios - Conditional segue performed on tap on UITableViewCell

I'm working on some project for iOS 5 using Xcode 4.2. I have one UITableViewController and want to perform a segue when user tap on table cell, but destination view controller depends on action performed on that cell. For example, when user tap on cell I would like to load SomeViewController, but when user tap on the same cell in editing mode I would like to load AnotherViewController. Unfortunately, there is no way to configure multiple segues on same cell in Xcode 4.2 storyboard builder, or I just don't get it. Perhaps there is a way to create segue by hand, in code editor. Generally what I want to achieve is to provide user a way to "enter" the item represented by cell using one view controller and "edit" the item represented by the same cell using another view controller. Switching to the second view controller (editor) when in table-edit-mode only was my first though, but maybe there is a better way. Any help will be appreciated.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

While looking Storyboard, control-drag from your source View Controller to your Destination view controller. This will create a segue that you can trigger programmatically right from your source View Controller. Ensure that you give you Segue a name. This name is what you will pass into the source View Controller's performSegue:withIdentifier: method.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...