I’m making an app which has a tableview and a DetailViewController. I’m using Apple’s “MultipleDetailViews” code as a launchpad. I want to make this app have around 100 rows in the split view and I want the detail view to change for each row (read 100 views). How can I do this using interface builder but without generating 100 class files and changing names repeatedly?
Currently the only method I have is to create separate view controllers (with class files) manually. This is very agitating, however.
Is there anyway I can use one DetailViewController, add several views to it inside interface builder and push each view when I choose a row in the tableview.
On each view I want to add a background image and three buttons that contain different sounds (every row’s view will have three unique sounds). How can I only create three IBActions and change the sound file path according to what row is selected?
Is there any time-efficient way to do what I am asking?
100 view controllers classes? That’s no good.
100 instances of a single view controller class? I should hope not.
Let’s get you the behavior you described with 2, just 2. You have a controller for your table view and a controller for your detail view. That’s it.
When you select a row in the table view pass that row index to the detail view controller and give the detail view controller a way to load the correct image and sounds based on that row.
That could be from a naming convention for your image and sound resources (‘background0’, ‘background1’, …) or it could be from some config file which defines the the background image and sounds for each row (a plist containing an array of dictionaries: [{background:”moon.png”, firstSound:”clown.mp3″, secondSound:”moose.mp3″, thirdSound:”water.mp3}, {…}, …]).