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

Design pattern with Custom Views

I need the help of an experienced app coder. I am designing an app which is similar to the Playlist Browser application.

It has a main screen that has a list of different Names. Once you select a name, the app then has to show another screen with either one or two UIImageViews depending on the name you selected.

For example: Let's say on the first there are two option: Jokes and Thoughts. If you select Jokes, it takes you to a page which has two images one says Tap for Dad Jokes other one says Tap for non dad jokes.

But let's say you select Thoughts on the main page, then you are taken to another screen which only has one image in the center that says "Tap for a random Quote."

I can't seem to figure out the design pattern required. I have a MainScreen class and a DeckScreen class. In the MainScreen class I have two buttons that say Jokes and Thoughts. In the DeckScreen I have a custom view called DeckView class. How do I make the DeckView draw one or two decks (aka images) depending on which one I select.

Please ask me further if you don't understand my question. I would be happy to explain better.