-
-
Save ahmedk92/1364ae8a3ee5abec32bf7663f06d14d4 to your computer and use it in GitHub Desktop.
Common initialization methods for a custom view in Objective C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)commonInit { | |
// Do stuff. | |
} | |
- (instancetype)init { | |
if (self = [super init]) { | |
[self commonInit]; | |
} | |
return self; | |
} | |
- (instancetype)initWithFrame:(CGRect)frame { | |
self = [super initWithFrame:frame]; | |
if (self) { | |
[self commonInit]; | |
} | |
return self; | |
} | |
- (instancetype)initWithCoder:(NSCoder *)aDecoder { | |
if (self = [super initWithCoder:aDecoder]) { | |
[self commonInit]; | |
} | |
return self; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment