2013-10-05 45 views
0

伙计们可以有人告诉我为什么我不能很好地对齐这些单元格中的标签? ...黑色和黄色标签之间的空间应该是相同的,但我无法弄清楚你想在代码中改变的确切点...当然这是一个微不足道的,但我迷路了 enter image description here高度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; 
} 

回答

0

代码中,我通过移除自动布局,并与尺寸检查器中设置块解决它......我认为这是最好的解决办法,尤其是没有问题的。 ..我希望...

相关问题