Hi everyone
Iam working on UITableView and doing an customization for a cell of each row.However, my image can not be displayed at all
What I am having so far is
At DetailCell.m:
Can anybody point it out if I have made a mistake somewhere. I appreciate that
------------
Anyone comes up with an idea please help.....
Iam working on UITableView and doing an customization for a cell of each row.However, my image can not be displayed at all
What I am having so far is
Code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"reUsedDetailCell";
DetailCell *cell = (DetailCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; // this is my customized cell
if ( cell == Nil ) {
cell = [[DetailCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; // do initialization
}
return cell;
}
At DetailCell.m:
Code:
//
// DetailCell.m
#import "DetailCell.h"
@implementation DetailCell
@synthesize itemImg; // itemImg is type of UIImageView
@synthesize itemName;
@synthesize itemDesp;
@synthesize itemSize;
@synthesize itemPrice;
@synthesize itemInfo;
@synthesize addItem;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.backgroundColor = [UIColor redColor];
itemImg = [[UIImageView alloc] init];
[itemImg setImage:[UIImage imageNamed:@"gear_24.png"]] ;
//[self.contentView addSubview:itemImg]; // I comment this out because itemImg is already in DetailCell by using Storyboard
}
return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
Can anybody point it out if I have made a mistake somewhere. I appreciate that
------------
Anyone comes up with an idea please help.....
Last edited by a moderator: