I have a custom view that I want to be able to initialize both in-code
and in nib
.
What's the correct way to write both initWithFrame
and initWithCoder
methods? They both share a block of code that is used for some initialization.
http://stackoverflow.com/questions/7226239/objective-c-custom-view-and-implementing-init-method
16
15
|
I have a custom view that I want to be able to initialize both What's the correct way to write both | ||
add a comment
|
30
|
The right thing to do in that case is to create another method containing the code that's common to both
Do heed the concerns outlined in Justin's answer, particularly that any subclasses must not override |