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
6
votes
3 answers

Loading UITableViewCell from a xib (this class is not key value coding-compliant for the key)

I'm curious as to the proper way to use a xib file to layout the contents of a UITableViewCell. When I try to follow all the steps I find on the Internet I always get Terminating app due to uncaught exception 'NSUnknownKeyException', reason:…
Bryant Harris
  • 728
  • 5
  • 21
4
votes
3 answers

Unexpected behavior when autoresizing subviews loaded from nibs

I am making some sort of "form" with many input fields (some are textfields, some are switches, some gather info from pickers etc). There are 6 sections in this form, and the nature of some answers influences the rest of the interface (for example,…
phi
  • 10,634
  • 6
  • 53
  • 88
3
votes
1 answer

Why set customCell property to nil using UINib

I'm looking at some Apple sample code using the UINib method for cellForRowAtIndexPath for UITableView: -(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath { static NSString *QuoteCellIdentifier…
J W
  • 868
  • 1
  • 12
  • 25
3
votes
1 answer

File manager with reuse of UIViewController when the data come from the network

please help! I'm trying to implement a file manager that works with web server I have a UITableView with custom cell from .xib and I'm using this code to register cell         self.tableView.registerNib (UINib (nibName: MaterialCell, bundle: nil),…
user2999910
2
votes
0 answers

Can't add self as subview - when adding xib file as subview

I'm trying to put a xib file as subview in my master viewController, and I get a really really strange error message; when I have this code : class MyViewController: UIInputViewController { var mainView : UIView! override func…
StrawHara
  • 1,301
  • 19
  • 33
2
votes
0 answers

How to set File's Owner to a custom UITabelViewCell loaded from nib?

I have a custom UITableViewCell loaded from a xib file and instantiated with a view controller as its owner: - (void)viewDidLoad { ... UINib *templateCellNib = [UINib nibWithNibName:@"TableViewCell" bundle:nil]; UITableViewCell…
oozywaters
  • 1,171
  • 1
  • 8
  • 17
2
votes
1 answer

How to load CustomView with CustomView.xib when specify class in another XIB?

I create CustomView:UIView with CustomView.xib file. Now I want to use it by drag view into another XIB (ex: UIViewController.xib) and choose class: customView. I can load successful when I init CustomView and addSubView to anotherView: -…
LE SANG
  • 10,955
  • 7
  • 59
  • 78
1
vote
2 answers

Looping through phone numbers, creating a custom view and passing it the phone number in swift

I'm having trouble creating a view programatically inside a for loop from another controller. The parent controller is a tableviewcell and I'm looping through a bunch of phone numbers inside a CNContact object. For each phone number the contact has…
Peter
  • 330
  • 1
  • 4
  • 18
1
vote
1 answer

Custom UITableView cell Nib file only shows up after select cell?

When I load my app this is what happens. For some reason the table view loads blank. And only when I select the cell and click another cell does the previously selected cell show up. But for the first cell, no matter where/how I click I still can't…
14wml
  • 4,048
  • 11
  • 49
  • 97
1
vote
1 answer

Loading multiple cells from XIBs in UICollectionView makes scrolling laggy on the first load

I have a collection view with like 7-8 different cells. Cells are constructed in XIB files. Then in View Controller I use: [self.collectionView registerNib:[UINib nibWithNibName:name bundle:nil] forCellWithReuseIdentifier:name]; Everything works…
NKorotkov
  • 3,591
  • 1
  • 24
  • 38
1
vote
1 answer

Loading nib and instantiating view with UIDatePicker take a lot of time

I have simple xib with two views: container view with date picker and toolbar with bar buttons. I use it as inputView and inputAccessoryView for my input fields (). But I've faced with performance issue: I've noticed that loading nib of…
Mykola Denysyuk
  • 1,935
  • 1
  • 15
  • 15
1
vote
0 answers

Objective-C avoid UINib caching

I have an issue. In my app I use xib files with lots of images and I have noticed that UIViewController or UINib class caches nib file`s content in the memory. I do not need such kind of behavior. I need resources to be released after dealloc of…
1
vote
1 answer

UINib file should not be initate until i tell hime to initate

I've a nib file in which i added 2 views. Now, i want to initate(init) my second view in my code, because i show it again and again after initate. so when i try to load nib file like: UINib *nib = [UINib nibWithNibName:@"Taxi_Login_View"…
Ali Raza
  • 1,183
  • 1
  • 10
  • 15
1
vote
1 answer

init or initWithNibName not getting called when loading nib file manually

I am loading the nib file manually (for UIView reusability), the code for loading the nib file - (NSArray*)loadMyNibFile { UINib *nib = [UINib nibWithNibName:@"customView" bundle:nil]; NSArray *topLevelObjs = [nib instantiateWithOwner:self…
Alexy Ibrahim
  • 554
  • 1
  • 7
  • 20
0
votes
1 answer

Assigning the outlet for a UITableViewCell using UINib

I looked at the TableViewUpdates/TVAnimationGestures from Apple's WWDC 2010 code and am having trouble duplicating a UITableViewCell subclass. This is what I've done: I created a new UITableViewCell subclass with some simple properties: @interface…
Crystal
  • 28,460
  • 62
  • 219
  • 393
1
2 3