Reputation: 3442
I have a custom class which subclasses UIView
. I have some configurations which I would like to do but from what I read, the use of messages towards self
is discouraged in the init
method. This is my init
method:
- (id) initWithMondayFirst:(BOOL)mondayFirst timeZone:(NSTimeZone*)timeZone andMonth:(NSDate*) month
{
if(self = [super initWithFrame:CGRectMake(0, 0, VIEW_WIDTH, VIEW_HEIGHT)]){
_timeZone = timeZone;
_mondayFirst = mondayFirst;
_currentMonth = [month monthBeginning];
[self configureNumberOfRows];
[self configureLimitations];
[self setBackgroundColor:[UIColor yellowColor]];
[self configureDimensions];
[self configureMonthLabel];
}
return self;
}
My question is, where should I put all those configuration methods? I need them by the time I reach the drawRect:
method. I thought of putting them in it but I don't think it's a good idea. Thanks.
PS: most of those config methods configure some of the properties of the class.
Upvotes: 1
Views: 101