Questions tagged [uinib]

Instances of the UINib class serve as object wrappers, or containers, for Interface Builder nib files. An UINib object caches the contents of a nib file in memory, ready for unarchiving and instantiation. When your application needs to instantiate the contents of the nib file it can do so without having to load the data from the nib file first, improving performance.

About UINib

Instances of the UINib class serve as object wrappers, or containers, for Interface Builder nib files. An UINib object caches the contents of a nib file in memory, ready for unarchiving and instantiation. When your application needs to instantiate the contents of the nib file it can do so without having to load the data from the nib file first, improving performance. The UINib object can automatically release this cached nib data to free up memory for your application under low-memory conditions, reloading that data the next time your application instantiates the nib. Your application should use UINib objects whenever it needs to repeatedly instantiate the same nib data. For example, if your table view uses a nib file to instantiate table view cells, caching the nib in a UINib object can provide a significant performance improvement.

When you create an UINib object using the contents of a nib file, the object loads the object graph in the referenced nib file, but it does not yet unarchive it. To unarchive all of the nib data and thus truly instantiate the nib your application calls the instantiateWithOwner:options: method on the UINib object.

See Documentation and Examples

35 questions
0
votes
1 answer

Objective-C - Given a UINib instance how can I initialize my custom UIView?

I have a Custom UIView that I want to initialize from a nib. I don't have access to the name of the nib, all I have is an instance of UINib. How can I initialize my UIView using this UINib object? I don't want to use loadNibNamed method in NSBundle
aryaxt
  • 76,198
  • 92
  • 293
  • 442
0
votes
1 answer

Why does UITableviewCell UINib init crash

I am using UITableviewCell in view using UINib and adding it to contentView. I don't get any error when I debug or test from testflight but Crashlytics has a lot of crashes 0x102d20 std::__1::vector
OMANSAK
  • 1,066
  • 1
  • 12
  • 30
0
votes
2 answers

How to solve NSInternalInconsistencyException: reason: 'Invalid parameter not satisfying: (name != nil) && ([name length] > 0)'

I get an NSInternalInconsistencyException when I use the OPPWAMobile payment library. I need to pass name somehow to OPPPaymentSchemeViewController so it passes it to initWithNibName. But I'm not sure how to do that in Xcode. I've checked this stack…
Fahad Alrashed
  • 1,272
  • 2
  • 11
  • 17
0
votes
0 answers

UITableView RegisterNib func is called, however awakeFromNib func is never called

Here is the snippet for register nib: [tableView registerNib:[self returnNib] forCellReuseIdentifier:identifier]; cell = [tableView dequeueReusableCellWithIdentifier:identifier]; then here is the snippet from awakeFrom nib: - (void)awakeFromNib…
0
votes
2 answers

'NSInternalInconsistencyException' reason: 'Could not load NIB in bundle' when dequeuing tableview cell

I have no clue why I am getting this error and I have tried looking at other answers, but could not find a solution. The code in question: override func viewDidLoad() { super.viewDidLoad() messagesTableView?.register(UINib.init(nibName:…
0
votes
1 answer

Why outlet cannot be init within initWithCoder?

We all know that as soon we drop an outlet inside a View or its ViewController, it is being marked as unwrapped and we all know that Swift wants to initialise all the properties within the initialisation phase and this is the sentence we give to…
ndPPPhz
  • 315
  • 1
  • 15
0
votes
1 answer

reload UITableView in UINib which is in an UITableView

The title sounds a bit more confuesing as it is. I have an UITableView where I instantiate a UINib which holds a UITableView. This TableView lets call it "DetailTableView" displays some information which can be added in another ViewController - so…
Michael
  • 5
  • 4
0
votes
1 answer

persist array of UINib

I have an issue and I can't find any information out there... The thing is I have an Array of custom UINibs which each have their standard Class after I created them as a CustomTableViewCell. import UIKit class TestCell1: UITableViewCell…
Michael
  • 5
  • 4
0
votes
1 answer

swift - save reorder of custom static uitableviewcell

I have a few custom tableview cells which all have a different unib and different classes and want to reorder the cells and persistent safe their reordered position. I have registered every cell and UINib in my TablevViewController let…
Michael
  • 5
  • 4
0
votes
1 answer

iOS Memory leak with nib

class CView: UIView { // MARK: - class class func nibView(frame: CGRect, assertion: Assertion?,contentReference: ContentReference?, delegate : AssertionViewDelegate? = nil) -> CView { let view = UINib(nibName: "CView", bundle:…
Ankish Jain
  • 11,305
  • 5
  • 36
  • 34
0
votes
1 answer

UINib (iOS): possible to instantiate more than one view from a nib file?

I noticed that UINib:instantiate(withOwner:options:) returns an array. Does this mean that one nib file can contain more than one view? In every example I saw there was only one view, which was the first object in the array. What are the other…
Yotam
  • 9,789
  • 13
  • 47
  • 68
0
votes
3 answers

How to resize custom UITableViewCell nib file to fit tableView?

My app currently loads like this. As you can see this is not ideal b/c the cell does not fill the entire cell. Also if you notice on the very left of every cell, the white separator line stops before the end of the cell. I'm using a nib file…
14wml
  • 4,048
  • 11
  • 49
  • 97
0
votes
1 answer

IOS loadingView from nib

I have this optimization problem. I have a view in nib that consists of the picture and a label. Here is the way I load it from the nib: @IBOutlet weak var imageView: UIImageView! var view: UIView! let nibName = "customView" override init(frame:…
Olexiy Burov
  • 1,007
  • 3
  • 11
  • 22
0
votes
2 answers

Size of view in Nib File for TableViewCell

I am trying to get UIImageView width that's in a nib file to make it circle but I am getting wrong value Here is my code : - (void)viewDidLoad { [super viewDidLoad]; //.... UINib *cellNib = [UINib nibWithNibName:@"User_Row" bundle:nil]; …
mmrayyan
  • 53
  • 1
  • 5
0
votes
1 answer

Loading nib files really fast

Trying to load a few hundred UINib consecutively and really fast (one after the other in less than 0.5sec). UINib contain UIButton and a relatively small sized image (different for each nib). I have tried this: UINib *nib = [UINib…
George Asda
  • 2,119
  • 2
  • 28
  • 54