我在 uitableview 单元格中添加了 3 个 uilabels。我遇到的问题是当我滑动删除时,单元格右侧的 UILabel 没有移动,因此删除按钮和 UILabel 相互重叠。我在下面发布了我的一些代码。
我使用故事板开发了我的布局,所以从我正在阅读的内容来看,框架不会有帮助。
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
NSString *baseTableCellIdentifier = @"baseCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:baseTableCellIdentifier];
BaseInfo *infoAtIndex = [[[DataClass getInstance] allItems] objectAtIndex:[indexPath row]];
baseName = (UILabel *)[cell viewWithTag:1];
baseICAO = (UILabel *)[cell viewWithTag:2];
baseTime = (UILabel *)[cell viewWithTag:3];
[cell.contentView addSubview:baseName];
[cell.contentView addSubview:baseICAO];
[cell.contentView addSubview:baseTime];
[baseName setText:[infoAtIndex name]];
[baseICAO setText:[infoAtIndex icao]];
baseTimeZome = [NSTimeZone timeZoneWithName:[infoAtIndex timeZone]];
[baseDate setDateFormat:@"HH:mm"];
[baseDate setTimeZone:baseTimeZome];
NSString *baseTimeString = [baseDate stringFromDate:[NSDate date]];
[baseTime setFont:[UIFont boldSystemFontOfSize:20]];
[baseTime setText:baseTimeString] ;
return cell;
}
-(void)setEditing:(BOOL)editing animated:(BOOL)animated{
if (editing) {
//no idea what to put here
}else{
}
}