i set my view controller to the particular view through Interfacebuilder. but initWithFrame is not calling , but drawRect is being called?when i put break point?
Right, because it's not guaranteed that initWithFrame:
will be called when unarchiving the xib. Try using awakeFromNib
or viewWillLoad
or viewDidLoad
. Which one you choose will mainly depend on at what stage during the display process you need to insert your code.
Also, check out the answer to this question.
According to the documentation - http://developer.apple.com/library/ios/#documentation/uikit/reference/UIView_Class/UIView/UIView.html - initWithFrame:
is not called when your view objects are subsequently loaded from the nib file. Objects in a nib file are reconstituted and then initialized using their initWithCoder:
method, which modifies the attributes of the view to match the attributes stored in the nib file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With