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

how do you connect a navigation controller to a UIButton without storyboard?

how do you connect a navigation controller to a UIButton within a cell of a Table View Controller without storyboard? (programmatically)

4 Answers

Thomas Nilsen
Thomas Nilsen
14,957 Points

Here is an example I wrote now that should help you out :) The trick here is to make your own delegate ;)

https://www.dropbox.com/s/30qs7k290ou1gil/theAnswer.zip

Thanks you have a twitter?

I think first you create both bottom and the navigation controller then go to the button if you are using segue use this one [ self performseguewithidentifier:(name of the segue here with no parenthesis around it) animation :YES completion nil;]

OR the here is the present view controller code

       [self presentViewController:<#(UIViewController *)#> animated:<#(BOOL)#> completion:<#^(void)completion#>
    ]

this method works with the table view controller, but not with the table View cell

Thomas Nilsen
Thomas Nilsen
14,957 Points

I'm not sure if I understand the question (once I do I guarantee you I'll find a solution). Do you mean you have a button within a cell and when you tap that a new controller is going to be displayed?

yeah exactly, but without storyboard (storyboard is easy)

Thomas Nilsen
Thomas Nilsen
14,957 Points

Glad I could help :) I rarely use twitter :P