Это таблицаView, как вы можете видеть, какая ячейка имеет две части, левая, - leftUIView, а правая - rightUIView. Красный и зеленый цвета могут отображаться, но созданная вами rightLabel не может быть успешно показана. Что случилось с моим кодом? Спасибо.Почему текстовый файл не может загружаться в моей ячейке?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *SectionsTableIdentifier = @"SectionsTableIdentifier";
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:SectionsTableIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:SectionsTableIdentifier] autorelease];
}
cell.textLabel.textColor = [UIColor whiteColor];
UIView *rightUIView = [[UIView alloc] initWithFrame:CGRectMake(160, 0, 160, cell.frame.size.height)];
[rightUIView setBackgroundColor:[UIColor greenColor]];
UIView *leftUIView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 160, cell.frame.size.height)];
[leftUIView setBackgroundColor:[UIColor redColor]];
UILabel *rightLabel = [[UILabel alloc] init];
[rightLabel setText:@"dummy"];
[rightUIView addSubview:rightLabel];
[cell addSubView:leftUIView];
[cell addSubView:rightUIView];
}
Этот код не отображает ни один из ваших объектов left/rightUIView. Отправьте код, который вы используете. Возможно, что-то не так с этим кодом, но без * оригинального * кода он просто догадывается. – Eiko