Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)

Thread Rating:
  • 389 Vote(s) - 3.62 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Could not load IBDesignable xib in the Interface Builder

I have a `xib` (`childXib`) file linked to its custom `UIView` swift file through its Owner.

This is how I initialize my custom `UIView`:

// init for IBDesignable
override init(frame: CGRect) {
super.init(frame: frame)

let view = loadViewFromNib()
view.frame = bounds


required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)

func loadViewFromNib() -> UIView {

let bundle = NSBundle(forClass: self.dynamicType)
let nib = UINib(nibName: "CommentCellView", bundle: bundle)
let view = nib.instantiateWithOwner(self, options: nil)[0] as! UIView

return view

When I want to add this `xib` (`childXib`) in another `xib` (`parentXib`), I get the following errors:

> error: IB Designables: Failed to render instance of MyRootView: The agent threw an exception.

Where `MyRootView` is the file linked to `parentXib`

> error: IB Designables: Failed to update auto layout status: The agent raised a "NSInternalInconsistencyException" exception: Could not load NIB in bundle: 'NSBundle </Applications/> (loaded)' with name 'MyIBDesignableCustomViewFilename'

Where `MyIBDesignableCustomViewFilename` is the file linked to `childXib`.

When I debug it by clicking on `Debug` in `Custom class` from the `Identity inspector`, it doesn't work from that line:

let view = nib.instantiateWithOwner(self, options: nil)[0] as! UIView

All the `xib` files are in `Copy Bundle Resources` in `Build Phases`.

Any idea what's wrong?

Forum Jump:

Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through