I'm in need of a custom UIView
which is to be used in multiple different ViewControllers
.
Usually when I create a custom UIView
, I drag an instance of UIView
into my ViewController
in storyboard, create a subclass of UIView
, and point to this subclass in the Identity Inspector
for the view. From there, I would connect the UI-objects as outlets to the header-file of the subclass.
The view I want to make now, is not supposed to be a part of any specific controller, but should be added to any controller that asks for it. A rogue UIView
. I know I can create the entire UIView
programmatically, and just create an instance of it, but I'd like to have it (and design it) in my storyboard.
In Storyboard, the only objects I'm allowed to drag 'outside a ViewController', are other ViewControllers.
I have never used anything other than Storyboard for iOS-developing, but I have come over tutorials which have been using the other mode, from the olden days, which looks like what I need. Is it possible to get something similar into my storyboard? Or would this require its own setup/design? If so, how?
I was also thinking of solving this with adding a 'phantom' UIViewController
containing my custom View; designing it there, but instantiate it from the other controllers, but this sounds so hacky..
I'd like to do this with a UITableViewCell
as well, but I guess that would have the same solution.