Я работаю над пользовательской ячейкой в uitableview и пытаюсь добавить uilabels в ячейку, но не могу установить для нее текст. Вот как я пытаюсь добавить ячейку, а также как я добавляю текст
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *MyIdentifier = @"MyIdentifier";
customCell *cell = (customCell *)[tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil) {
cell = [[[customCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier] autorelease];
cell.imageView.image = [UIImage imageNamed:@"iTeam.png"];
}
cell.orangeText1 = @"Mikes Bar";
cell.orangeText1 = @"4.3 mi northeast";
cell.whiteText1 = @"Level";
cell.whiteText1 = @"Freshman";
return cell;
}
Класс ячейки My Custom:
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if ((self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])) {
// Initialization code
//
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 60)];
view.backgroundColor = [UIColor blackColor];
view.opaque = YES;
self.backgroundView = view;
[view release];
cellImage = [[UIImageView alloc] init];
myLabel *lblview = [[myLabel alloc] initWithFrame:CGRectMake(self.imageView.frame.size.width+10, 0, 320, 20) OrangeText:orangeText1 WhiteText:whiteText1];
[self.contentView addSubview:lblview];
[lblview release];
lblview = [[myLabel alloc] initWithFrame:CGRectMake(self.imageView.frame.size.width+10, 22, 320, 20) OrangeText:orangeText2 WhiteText:whiteText2];
[self.contentView addSubview:lblview];
[lblview release];
UIImage *image = [UIImage imageNamed:@"acessory.png"];
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
CGRect frame = CGRectMake(0.0, 0.0, image.size.width, image.size.height);
button.frame = frame;
[button setBackgroundImage:image forState:UIControlStateNormal];
button.backgroundColor = [UIColor clearColor];
self.accessoryView = button;
[button release];
UIImageView *imagevw = [[UIImageView alloc] initWithFrame:CGRectMake(0, 50, 320, 8)];
imagevw.image = [UIImage imageNamed:@"linee.png"];
[self addSubview:imagevw];
[imagevw release];
}
return self;
}
Все остальное работает нормально, но я не получаю текст на этикетке. Сам ярлык вызывается из другого класса uiview.
Спасибо