Questions tagged [awakefromnib]

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

81 questions
0
votes
0 answers

Unable to Dequeue Registered CollectionViewCells

Searched here and there but I couldn't find anything that I haven't already tried to fix my issue, so going to ask it again. I am trying to use a collection view with custom cells. The main collection view is in the Main View Controller. I'm using a…
oğuz
  • 145
  • 1
  • 13
0
votes
0 answers

Set properties before awakeFromNib fires

I need to set a property of a UIView before awakeFromNib is fired. This is what I tried: if let views = Bundle.main.loadNibNamed("MyNib", owner: self, options: nil) as? [MyNib], views.count > 0 { let v = views.first! v.count = 78 //…
user11034123
0
votes
1 answer

awakeFromNib Returning Null UILabel Values

I am using a custom cell inside my table view. I have a view and I have a button inside that view that when the cell loads it checks if the array contains a labels text inside the cell. When I try get the text of a label it returns an empty value,…
Curtis Boylan
  • 827
  • 1
  • 7
  • 23
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
0 answers

@IBOutlet UITableView! is nil when i set it's delegate inside function awakeFromNib()

I use a xib file to build a UIView called SelectView which has a button and a tableView inside it. Code shows below @IBOutlet weak var selectTableView: UITableView! @IBOutlet weak var notSureButton: UIButton! and I programmatically set the…
0
votes
2 answers

Handling of awakeFromNib for the object that is File's Owner

I know there are many related questions why awakeFromNib is not called when instantiating some view. The message that the certain view is awaken from Nib is sent to the view itself and this message is not delivered to the File's Owner. I saw Why…
Kazuya Tomita
  • 667
  • 14
  • 34
0
votes
1 answer

Are nib/xib files meant to be used in diffrent view controllers ?

I watched multiple videos on youtube and bought two books with explanations (O'Reilly). It seems like a nib file is always used in one view controller. The file-owner is usually the view controller which will implement that nib. I couldn't find an…
3366784
  • 2,423
  • 1
  • 14
  • 27
0
votes
0 answers

awakeFromNib not get called in UIViewController subclass with xib file

Maybe you see this question is kind of duplicated question. But I want to ask a new question because the other questions are ancient. I'm working with iOS 10.3 by Xcode 8.3.1. In my case, I subclass UIViewController using xib, all thing seem fine,…
vietstone
  • 8,784
  • 16
  • 52
  • 79
0
votes
1 answer

Why should we use init(coder) when we can just dump everything inside awakeFromNib?

I read What exactly is init coder aDecoder? but that doesn't answer to why not put everything inside awakeFromNib and forget using init(coder aCoder : NSCoder)? In the comments of the accepted answer Fattie says: "sometimes you can't do that". You…
mfaani
  • 33,269
  • 19
  • 164
  • 293
0
votes
2 answers

How do I add UIViews to my contentView (AwakeFromNib)

I am using separate UIView class which is initiating from awakeFromNib This is the view hierarchy of my custom class in which I have to add custom views to contentView. I am not getting how to add my customViews as subviews to contentView. This is…
Saheb Singh
  • 555
  • 4
  • 18
0
votes
1 answer

awakeFromNib() is not working on simulate metric

Hi I have a question about layout. I use the storyboard to set layout. And I had set an UI Components via the storyboard. To support iPhone5 or iPhone 6 Plus.. I'm writing code like this. enter//1. called awakeFromNib() @IBOutlet weak var…
Shawn Baek
  • 1,928
  • 3
  • 20
  • 34
0
votes
1 answer

awakeFromNib vs Outlets - Do the outlets and segues set when we call awakeFromNib

I'm trying to understand a view controller's lifecycle and I've read a few contradictory statements about awakeFromNib. The docs say that all outlets should be set in awakeFromNib but I see that it's not always true. What is the call's order between…
Vitya Shurapov
  • 2,200
  • 2
  • 27
  • 32
0
votes
1 answer

UITableViewCell calling .layer.maskToBounds = YES in subview performance issue

I have a custom UITableViewCell that contains a UILabel that I want to have rounded corners. Like I've done many times before I set the corner radius and use maskToBounds to do this programmatically. The cell itself is created in Storyboard. I call…
0
votes
1 answer

-awakeFromNib in UIView Category

is it safe to write code in -awakeFromNib method on UIView Category. UIView+XXXXXX.m @implementation UIView (XXXXXX) - (void) awakeFromNib { /* some code here */ } @end
iOSTech
  • 77
  • 1
  • 8
0
votes
2 answers

awakeFromNib Not Called in iOS 9

I am running into an interesting issue. I have a view controller: LoginViewController *viewController = [LoginViewController alloc] init]; In the methods initWithNibName:bundle: and awakeFromNib I have some initialization code. The…
tentmaking
  • 2,076
  • 4
  • 30
  • 53