Reputation: 215
I have 3 custom View Controllers having almost similar design.
How can I create a view (in Storyboard or using XIB) so that I can use the same view for my 3 View Controllers?
Upvotes: 11
Views: 3032
Reputation: 52
I've had the same problem and created a Github repo to solve it: https://github.com/MaherKSantina/MSAutoView
Steps:
Detailed steps are available in the Readme of the repo.
Cheers
Upvotes: 0
Reputation: 7193
Make custom view with xib add common design that all 3 view controller. Now add UIView in that view controller and give super class of that UIView to that custom class and this way you can use this custom view on 3 controller
See this i have use same view in multiple controller
Upvotes: 3
Reputation: 675
/*******************/
Method 1:
create a class Base of type UIViewController
, implement all design here.
Next Create class A of type Class Base. Next Again, Create class B of type Class Base. Next Again, Create class C of type Class Base. this is called sub Classing.
Method 2:
use All different ViewController. if you have any UIView Similar for all viewControllers, create its different Class and Allocate its object from each class. then use delegates And block to perform operations between UIViewControllers and UIView class.
Upvotes: 0