awakeFromNib an Objective-C instance method which Prepares the receiver for service after it has been loaded from an Interface Builder archive, or nib file
Questions tagged [awakefromnib]
81 questions
35
votes
2 answers
When does awakeFromNib get called?
Does awakeFromNib get called right after viewController is allocated and initialized?
At what precise point does the awakeFromNib of a view controller get called?
From my debugging session, I see that awakeFromNib for the rootViewController doesn't…

Boon
- 40,656
- 60
- 209
- 315
35
votes
1 answer
difference between awakeFromNib() and viewDidLoad() in swift
I want to know the key difference between awakeFromNib() and viewDidLoad() to get more clarity on how it works . Please can anybody explain?

sriram hegde
- 2,301
- 5
- 29
- 43
30
votes
4 answers
IBOutlet isn't connected in awakeFromNib
The sample code linked here works great and allows a UIScrollView to display images with paging and preview of the images before and after the current image:…

Sofi Software LLC
- 3,879
- 1
- 36
- 34
19
votes
1 answer
On awakeFromNib() - Error Instance member 'button' cannot be used on type 'CustomView'
I've created a custom UIView as a .xib file with the UIView having a single button. I load the UIView using the below code.
struct ContentView: View {
var body: some View {
CustomViewRepresentable()
}
}
struct…

Felix Marianayagam
- 2,634
- 2
- 9
- 29
10
votes
4 answers
viewDidLoad and awakeFromNib timing
It is my understanding that awakeFromNib will always be called before viewDidLoad.
So I have a subclass of a UITableViewController, which is unarchived from a xib file.
I defined these two methods inside:
- (void)awakeFromNib {
[super…

bogardon
- 896
- 2
- 10
- 22
8
votes
3 answers
Objective-C/Swift (iOS) When are the auto-constraints applied in the View/ViewController work flow?
I'm having some issues of figuring out when the auto-contraints setup on a XIB are applied in the view setup process.
For more explanation:
I've setup a XIB for a view
I set the "Simulated Metrics" Size to iPhone 3.5-Inch
I've added…

pkearney06
- 113
- 1
- 4
8
votes
2 answers
Bounds of custom UIView not correct during awakeFromNib - when are they set?
I have a custom UIView, which I have placed using Xcode (4). I need to set some default state, based on the actual bounds of the view. During awakeFromNib, bounds seems to be returning the size of the view in the storyboard layout in Xcode.
The…

Jono
- 91
- 5
8
votes
1 answer
Best way to set up a NSViewController initialized with initWithNibName:bundle:?
i have a subclass of NSViewController that loads its view from a nib (with initWithNibName:bundle: and it is the file's owner of that nib).
I need to do some initialization after the nib is loaded and i want my code to be the most compatible :
In…

Johnmph
- 3,391
- 24
- 32
7
votes
1 answer
the Benifits of awakeFromNib?
I've been learning coredata by making a lot of simple test apps based on the xcode Navigation controller template with "use coredata" checked.
The awakeFromNib method in the App delegate has been a source of problems for me, because I'm adding other…

nick
- 1,147
- 1
- 11
- 12
6
votes
1 answer
Setting Finished TabBar images when using storyboards?
I am working on an application where the bulk of the UI is setup via a Storyboard in Xcode. One thing that I want to do is specify "Finished" images for the UITabBarItems on a TabBar rather than the default "Stencilled" images that you can access…

fuzzygoat
- 26,573
- 48
- 165
- 294
6
votes
2 answers
Get outlet size within awakeFromNib
I created a custom UICollectionViewCell containing an outlet for a label (placed in the Storyboard). I'd like to get the height of this label from within the awakeFromNib method of my custom UICollectionViewCell, but the size of the label is always…

Guillaume Algis
- 10,705
- 6
- 44
- 72
6
votes
2 answers
awakeFromNib is not calling but displaying xib
I have created a new project in xcode 4.5 and I have called my viewcontroller by
-(id)initWithNibName:bundle:
from appdelegate as it called in default project template and i am not using storyboard
but awakeFromNib was not called
I have also…

codester
- 36,891
- 10
- 74
- 72
4
votes
2 answers
How to Call awakeFromNib in mainViewController.m
I have an xib file containing a custom cell. I'm trying to access the height of an object created in customCell.m.
Here is my code:
customCell.m
- (void)awakeFromNib
{
self.label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 50, 200)];
…
user4487951
4
votes
2 answers
awakeFromNib is not called for UITableViewCell object
I have a class that inherits from UITableViewCell, it has a bunch of IBOutlets. I had previously been using this object in a way that reuses the cell and initializes it as it's needed. This method is too slow, so I decided to create an array of the…

Tiddly
- 1,620
- 3
- 21
- 43
4
votes
2 answers
Font and textColor are gone - Yet another UITableViewCell awakeFromNib
I don't know if this is specific to UITableViewCells but rather general for UIViews (as i believe) but i noticed the problem with a cell.
As mentioned, I have a custom UITableViewCell subclass which loads itself from a xib when it gets…

yinkou
- 5,756
- 2
- 24
- 40