I am creating an application where there are some views i want to be available in each and every UIView Controller just like a master page in Web Development. i have created those views but how to add them to all the view controllers in the application automatically?
-
[Review this.](http://stackoverflow.com/questions/8919334/how-to-create-multiple-themes-skins-for-iphone-apps) – Buntylm May 28 '13 at 11:43
3 Answers
You should add them to mainWindow if you need to display them in all viewcontrollers.
Hope it helps you.

- 9,893
- 3
- 40
- 61
-
well for the window in Main-window there must be a root view controller .. and i add something to the window.. setting root view controller nullifies that.. so what should i do for that.. – May 28 '13 at 12:57
You need to convert the project and all the views that you created to a template first and then create a new project and use that template. Here is a guide I have used:
This guide explains how to create new project templates in Xcode. Project templates appear in the list of project types in the New Project dialog.
1.Create a new project and setup everything as you'd like (NIB files, graphics, sounds, settings, code etc)
Optionally, build and make sure the project works
Use Finder and locate the project folder for your project you created in step 1
Open another Finder window and navigate to /Library/Application Support/Apple/Developer Tools/Project Templates/. You have two options here:
Create a new folder for your custom project templates - this will appear as a category when creating a new project in XCode
Choose an already existing folder (eg Application) - this will place the project template in that category
5.Open the new/chosen category folder and create a new folder inside. You can name this new folder whatever you like and it will appear as the project template name.
6.Copy all files from the project folder in step 3 to the new template folder created in step 5.
7.Try to create a new project in Xcode. You should see your project template in one of the original categories or in the category you created, whichever you decided. Note: If you built the project, delete the build folder from the template folder.
Hope this would help you out.

- 6,479
- 4
- 38
- 55
-
How is this the accepted answer? These steps are for creating a XCode project template, not a reusable template for creating views with common layout/design/components in an app. – lukestringer90 May 28 '13 at 22:43
-
Sure no problem. The current accepted answer is much more applicable to your problem :) – lukestringer90 May 29 '13 at 08:24
Create a base view controller class which will have all these UIViews
added in its view. Additionally, you can also implement the events of these particular views in the controller. Other controllers that you create need to extend from this base view controller class.

- 13,202
- 7
- 53
- 71
-
whenever i create a subclass of the View controller that has to be the theme of the application and then create another view controller that implements the theme view controller it doesn't display the theme views.. what am i missing.. of if there is any tutorial for that please share the link.. – May 28 '13 at 13:09