Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Self-Destructing Message iPhone App Capturing Photo and Video Using UIImagePickerController viewDidLoad and the View Controller Lifecycle

viewWillAppear with TableViewController instead of Picker

I was just wondering if anyone knew if it was possible to, instead of having a UIPickerController pop over each time, have a UITableViewController show instead. I've tried using segue but it calls twice and I can't seem to get this working.

It's essentially the same code, however, instead of using images/video I'm trying to get the user to choose a certain cell from a TableView. I have all this stuff working, but it doesn't redisplay the cell to choose from after I close the view. Otherwise I put it in the viewWillAppear method and that's where it calls the segue twice causing a: nested push animation can result in corrupted navigation bar Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted. Error.

Thanks guys

1 Answer

Troy Fine
Troy Fine
7,592 Points

I don't see why you can't.

But I'm having trouble understanding what you are trying to do as far as the user experience goes. I'm making a guess, but are you wanting to transition to a UIView using a UITableViewController after a user selects a TableViewCell? My first impression is that you want to show the selection made by the user when the user taps or selects a cell. Again, just guessing here based on your description of the issue.

You can have the cell be highlighted when selected or you can go straight to the willDeselectRowAtIndexPath call. Every tap or gesture is an action event or multi-gesture event that you can use to animate your transitions to a new table view controller via a segue.

As far as your navigation and nested segue issue goes, you might want to refer to the guides on the Apple Developer website related to unwind segues or segues in general. The unwind segue method can be useful when the need to programmatically back track through the navigation tree arises. Link left below.

https://developer.apple.com/library/ios/samplecode/UnwindSegue/Introduction/Intro.html

This option to handle segues might help you with your navigation issues but I don't have any of your code for reference so this might just be a another shot in the dark.

Heres a link to view controller guide on the Apple Developer website for reference just in case I totally mis-understood your question or issue.

https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/Introduction/Introduction.html#//apple_ref/doc/uid/TP40007457

I'm not this far in this iOS track but I hope this is of some help.