Custom UIView from Xib file in Xcode 5 for Reusable Components - Part 1

Paul Solt · 41K views · 2014 · 12:38

Open on YouTube

Software practice, open source & careersWeb developmenttutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it as a step-by-step walkthrough for loading a custom UIView from a xib and wiring up outlets and the File's Owner correctly.

Recommended by 5 people across 5 different months, 2014 to 2016.

What it is

A 12-minute iOS tutorial by Paul Solt showing how to build a reusable custom UIView from a .xib file in Xcode 5. It covers setting the File's Owner, loading the nib in initWithCoder, and embedding the component in another xib or storyboard so it stays interactive.

What people said

Recommends Balazs Nemeth · 2015-01 · Stack Overflow · on “Creating a reusable UIView with xib (and loading from storyboard)”

There is a solution which is much more cleaner than the solutions above: [this video] No Runtime properties, no recursive call problem at all. I tried it and it worked like a charm using from storyboard and from XIB with IBOutlet properties (iOS8.1, XCode6). Good luck for coding!

Recommends theshadow124 · 2015-03 · Stack Overflow · on “Custom UITableViewController issue”

that was my problem, thanks for all the help. For anyone else with this issue. this video was helpful too: [this video]

Recommends Abhay Singh Naurang · 2015-06 · Stack Overflow · on “How to properly load my xib file with Auto Layout in a container in my storyboard?”

you want create custom UIView using a xib which will be reusable for you and you want to add on you view controller there is a better tutorial on this link [this video] please watch the video .

Recommends Micrified · 2015-09 · Stack Overflow · on “UIView: Loading from custom XIB causing a crash”

Hello StackOverflow. I am trying to setup a UIView such that it loads itself from XIB file in Xcode. To do this, I went through the following initial steps: Created empty UIView subclass. Added a blank XIB file. Then, I added all the subviews I wanted into the XIB file, and made corresponding IBOutlet Properties inside the UIView Subclass. I watched this video [this video] to show me how to properly connect the outlets and set the files owner. The video instructs me to do the following things: Do not set the UIView class to your subclass in XIB . Time link [this video] Set the File's Owner to your UIView subclass in XIB : Time Link [this video] Insert a IBOutlet into your UIView class of type UIView so you

Recommends codelearner · 2016-01 · Stack Overflow · on “Share View between Storyboards”

Not sure how to use that... But I have found this step by step tutorial *Custom UIView from Xib file in Xcode 5 for Reusable Components* at [this video]

Cites kAiN · 2014-11 · Stack Overflow · on “How to best way to call XIB file in Xcode 6 with Storyboard?”

hello and thanks for the reply ... I was following this tutorial ... and here I have a view controller but a UIView class that has its own xib to xib ... must be called in to the view controller [this video]

Cites j2emanue · 2015-05 · Stack Overflow · on “iOS -custom xib file not appearing as inputAccessoryView of UITextField”

I'm following this video [this video] (except im linking the custom view in code not in IB), but I'll explain what's happening. I have created a custom view that extends off UiView. It is created from an xib file. Here is a photo of the xib file in interfacebuilder: Notice that the file owner is already linked to my custom class. Now I'll show you my custom class: #import "CostcoLoginView.h" @implementation CostcoLoginView -(id)initWithFrame:(CGRect)frame{ self = [super initWithFrame:frame]; if(self){ } return self; } -(id)initWithCoder:(NSCoder *)aDecoder{ self=[super initWithCoder:aDecoder]; if(self){ [[NSBundle mainBundle] loadNibNamed:@"CostcoLoginView" owner:self options:nil]; [self addSubvi