Swift: How can I add Up & Down buttons and functionality on a detail view controller?

I am doing app development (and coding in general) but enjoy the journey :-)

(I am using Xcode 6.4) I have a table view controller with a prototype cell embedded in a navigation controller. The line-by-line behavior results in a detail view controller. Everything works fine.

I am interested in having the up and down buttons displayed in the Detail View Controller to save someone from having to go back and then down to the next detail ... so they just navigate between detail views.

Any pointers ... since I can't even drag the button to the navbar on the detail view controller, let alone wonder how to code the function :-)

Thanks a lot for your time!

PS can't post pic of storyboards as just joined stackoverflow

+3


source to share


2 answers


I'm afraid you will have to do it programmatically.

First, add some buttons to the navigation bar by doing this . And wire those buttons in your detail view controller.

Then, in each of your detail view controllers, you need to have some property like the previous item, the next item. In the preparatory segment, pass these elements from the main controller.



Finally, in button actions, load the previous / next item.

This is what I can think of based on your description, hope it helps.

0


source


You have next and previous session and in wizard go to next / previous line. Repeat one more time.

Do it quickly and don't use animation and no problem. We do it in stages, but pop, push the vc part in the same way.



Better Chris answer imho. It might just be less effort;)

0


source







All Articles