Storyboards vs. the old XIB way

There is benefit to learning both approaches. Apart from the historical value in the xib approach, xib’s also provide modularity. Perhaps you have a library of code or wish to share a useful widget you made. Taking the xib approach would facilitate that sharing and reuse. The xib approach also allows you some greater flexibility … Read more

Assign xib to the UIView in Swift

for Swift 4 extension UIView { class func loadFromNibNamed(nibNamed: String, bundle: Bundle? = nil) -> UIView? { return UINib( nibName: nibNamed, bundle: bundle ).instantiate(withOwner: nil, options: nil)[0] as? UIView } } for Swift 3 You could create an extension on UIView: extension UIView { class func loadFromNibNamed(nibNamed: String, bundle: NSBundle? = nil) -> UIView? { … Read more

Adding a custom subview (created in a xib) to a view controller’s view – What am I doing wrong

You need to load it using the -loadNibNamed method. -initWithNibName is only for UIViewControllers. Add the following code to your MyCustomView init method: NSArray *subviewArray = [[NSBundle mainBundle] loadNibNamed:@”MyCustomView” owner:self options:nil]; UIView *mainView = [subviewArray objectAtIndex:0]; [self addSubview:mainView]; Remember, if you are initializing an object from a nib, it calls – (id)initWithCoder:(NSCoder *)aDecoder to initialize, … Read more

What are the benefits of using Storyboards instead of xib files in iOS programming?

A Storyboard is: A container for all your Scenes (View Controllers, Nav Controllers, TabBar Controllers, etc) A manager of connections and transitions between these scenes (these are called Segues) A nice way to manage how different controllers talk to each other Storyboards give you a complete look at the flow of your application that you … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)