Nathan
Nathan

Reputation: 666

How to create a master view for an iPad app

What I'm looking to do is create some kind of master view, that would have the same header (with a logo), footer (with some text and a button), background image and navigation (not a navigation bar, just a few buttons) on every view.

You could think of what I'm after doing is like a PowerPoint presentation. Create a master slide that's layout is used through every slide, you create a new slide and it takes across all the masters properties (header, footer, background etc) and then it's just the content that changes on each new slide.

However, I'm not too sure how I would do this in an iOS application. I've had a look on Google searching many different phrases but all seem to be about iPad split views and using cells of a tableview, which isn't what I'm after. All I can think to do is create a single view controller class, with a view, and then add a sub UIView for each page I want (about 15-20), but with the one class, and every page having different content and a lot of code required for each one, that's going to get messy! Or I simply recreate the footer and header etc on every view controller, so if there were to be a change, then I'd have 20 views (more if it grows) to edit! So I'm just wondering if there's a simple way of getting what I'm after.

The app will be for iPad only, and I can use any OS up to 5, so xibs or storyboards are fine. And this won't be on the app store if that helps.

I've done a quick drawing below. The master view with all my bits to be used on each page, and then content slides that will slot in and out of the mater's content area.

enter image description here

Upvotes: 2

Views: 374

Answers (3)

Bittu
Bittu

Reputation: 371

If u want to show header and footer view in whole apps then add header and footer view in window not in view controller i think it will work

Upvotes: 0

LJ Wilson
LJ Wilson

Reputation: 14427

Check out Containment View Controllers. This kind of presentation is exactly what they are designed to handle. There is a really nice WWDC presentation from 2012 I believe that illustrates how these work. There are also several tutorials online if you search.

Upvotes: 1

dizzytri99er
dizzytri99er

Reputation: 930

maybe the best option is to create a master detail page. Then for each new page, call the master?

Upvotes: 0

Related Questions