I created a UITableView with cells that have different heights. In each cell, I added an accessory (UIImageView).
Depending on the height of the cell, the position of accessoriesType is different (see attached image). How can I fix it?
This seems to be normal in any table view. No answers found.
Thanks for your help. http://i.stack.imgur.com/kKOn0.png
UPDATE: My cellForRowAtIndexPath:
NSDictionary *currentTime = [listOfTimes objectAtIndex:indexPath.row]; UITableViewCell *cell; if([[currentTime objectForKey:@"freq"] intValue] > 0) cell = [self getCellFreqContentView:@"CellFreq"]; else cell = [self getCellContentView:@"Cell"]; [NSDateFormatter setDefaultFormatterBehavior:NSDateFormatterBehavior10_4]; NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease]; [dateFormatter setDateStyle:NSDateFormatterNoStyle]; [dateFormatter setTimeStyle:NSDateFormatterShortStyle]; UILabel *lblTemp1 = (UILabel *)[cell viewWithTag:1]; UILabel *lblTemp2 = (UILabel *)[cell viewWithTag:2]; if([[currentTime objectForKey:@"freq"] intValue] > 0) { lblTemp1.text = [NSString stringWithFormat:@"%@\n\n%@", [dateFormatter stringFromDate:[NSDate dateWithTimeIntervalSinceReferenceDate:[[currentTime objectForKey:@"arrival_time_seconds"] doubleValue]]],[dateFormatter stringFromDate:[NSDate dateWithTimeIntervalSinceReferenceDate:[[currentTime objectForKey:@"departure_time_seconds"] doubleValue]]]]; UILabel *lblTemp3 = (UILabel *)[cell viewWithTag:3]; UILabel *lblTemp4 = (UILabel *)[cell viewWithTag:4]; lblTemp3.text = @"↓"; lblTemp4.text = [NSString stringWithFormat:NSLocalizedString(@"A pass every %i minutes", nil), [[currentTime objectForKey:@"freq"] intValue]/60]; } else { lblTemp1.text = [dateFormatter stringFromDate:[NSDate dateWithTimeIntervalSinceReferenceDate:[[currentTime objectForKey:@"departure_time_seconds"] doubleValue]]]; } lblTemp2.text = [currentTime objectForKey:@"trip_headsign"]; cell.selectionStyle = UITableViewCellSelectionStyleNone; UIView *vv = [[UIView alloc] initWithFrame:cell.frame]; if(indexPath.row == [ScheduleManager getRowForTime:listOfTimes] && isCurrentPeriod == TRUE) { vv.backgroundColor = [BKColor colorWithHexString:@"54B8BB"]; }
source share