0
夥計們可以有人告訴我爲什麼我不能很好地對齊這些單元格中的標籤? ...黑色和黃色標籤之間的空間應該是相同的,但我無法弄清楚你想在代碼中改變的確切點...當然這是一個微不足道的,但我迷路了 高度TableView單元格:對齊標籤空間
這是我使用
- (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;
}