Я создал mycell, и в myTableview я создал, как я могу добавить UIView к cellForRowAtIndexPath
@property (strong ,nonatomic)NSArray *contentPictureArray;
это:
self.contentPictureArray = @[[UIImage imageNamed:@"[email protected]"],@"[email protected]"],[UIImage imageNamed:@"[email protected]"]];
Я хочу использовать cell.contentPictureView.view=[self.contentPictureArray objectAtIndex:indexPath.row];
, но не так, как может Я добавляю mycell к cellForRowAtIndexPath?
cell.stateView = [[UIView alloc] initWithFrame:CGRectMake(XB, HeiB+NY, WidB, 0)];
[cell addSubview:cell.stateView];
cell.contentTextView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, WidB, 0)];
[cell.stateView addSubview:cell.contentTextView];//动态文字部分
cell.contentLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, WidB, 0)];
[cell.contentTextView addSubview:cell.contentLabel];//动态文字label
cell.allContentBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, cell.contentLabel.frame.size.height, HeiB, 2*NX)];
[cell.contentTextView addSubview:cell.allContentBtn];//全文显示按钮
cell.contentPictureView = [[UIView alloc] initWithFrame:CGRectMake(0, cell.stateView.frame.origin.y+2*NX, HeiB+NY, 0)];
[cell.stateView addSubview:cell.contentPictureView];
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
KBTableViewCell*cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
if (cell == nil) {
cell = [[KBTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdent:@"cell"];
}
if(indexPath.row==0||indexPath.row==1){
cell.iconImageView.image = [UIImage imageNamed:@"avatar.png"];
}
cell.contentLabel.text=[self.listArray objectAtIndex:indexPath.row];
cell.nameLabel.text = [self.nameArray objectAtIndex:indexPath.row];
cell.timeLabel.text =[self.timeArray objectAtIndex:indexPath.row];
cell.contentPictureView.=[self.contentPictureArray objectAtIndex:indexPath.row];
return cell;
}
да, я пишу, но не так, есть красная ошибка: «Ожидаемый identefier, как я могу do – runsheng0324