伙计们,有人能告诉我为什么我不能很好地对齐这些单元格中的标签吗?...黑色和黄色标签之间的空格应该相同,但我无法弄清楚您要在代码中更改的确切点...当然这是微不足道的,但我迷路了
这是我正在使用的代码
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
{
NSString *comment = [[self.objects objectAtIndex:[indexPath row]] objectForKey:@"TITOLO"];
CGFloat whidt = 220;
UIFont *FONT = [UIFont systemFontOfSize:13];
NSAttributedString *attributedText =[[NSAttributedString alloc] initWithString:comment attributes:@ { NSFontAttributeName: FONT }];
CGRect rect = [attributedText boundingRectWithSize:(CGSize){whidt, MAXFLOAT}
options:NSStringDrawingUsesLineFragmentOrigin
context:nil];
CGSize size = rect.size;
return size.height +50;
}
- (FFCustomListaEsamiCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object {
FFCustomListaEsamiCell *cell = (FFCustomListaEsamiCell * )[self.tableView dequeueReusableCellWithIdentifier:@"Cell"];
if (!cell) {
cell = [[FFCustomListaEsamiCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];
}
NSString *text = [object objectForKey:@"TITOLO"];
CGSize constraint = CGSizeMake(220 , 20000.0f);
UIFont *FONT = [UIFont systemFontOfSize:13];
CGSize size = [text boundingRectWithSize:constraint options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:FONT }context:nil].size;
cell.FFTitoloEsameLabel.frame = CGRectMake(17,10, 240, MAX(size.height, 10.0)+10.0 );
cell.FFTitoloEsameLabel.text = text;
NSDateFormatter *FFDataFormattata = [[NSDateFormatter alloc] init];
[FFDataFormattata setDateFormat:FF_DATE_FORMATTER];
cell.FFDataEsameLabel.text = [NSString stringWithFormat: @"%@",[FFDataFormattata stringFromDate:[object objectForKey:FF_ESAMI_DATA_STRING]]];
PFObject *rowObject = [self.objects objectAtIndex:indexPath.row];
if([[rowObject objectForKey:FF_ESAMI_STATUS] boolValue]) {
cell.last.image = [UIImage imageNamed:@"FFIMG_ClockTAG"];
}
else
{
}
return cell;
}