Reputation: 38912
I have created my custom table cell class:
@interface CommonCell : UITableViewCell{
...
}
@end
In the implementation file of it, I have created a custom initializer method: initWithCellHeight:reuseIdentifier:showName
which called the [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier])
, like below:
@implementation CommonCell
- (id)initWithCellHeight:(float)cellHeight reuseIdentifier:(NSString *)reuseIdentifier showName:(BOOL)showName
{
if ((self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier])) {
[self createViews: showName];
}
return self;
}
When I use my cell class in my controller in the following way:
#import "CommonCell.h"
...
cell = [[[CommonCell alloc] initWithCellHeight:150 reuseIdentifier:@"CommonCellId" showName:YES] autorelease];
I got warning message : instance method "initWithCellHeight:reuseIdentifier:showName" not found
Why? Why I can not use my custom initialiser for my table cell?
Upvotes: 0
Views: 543
Reputation: 3824
Why is - (id)initWithCellHeight:(float)cellHeight reuseIdentifier:(NSString *)reuseIdentifier showName:(BOOL)showName
not present in the header file? You will need to declare it before using it to remove the warning.
Upvotes: 1