3 つのラベルを持つカスタム セルである UITablewViewCell でチェック マークを使用しようとしています。問題は、チェック マークの画像に使用する解像度やサイズに関係なく、下の画像のようにピクセル化されて見えることです。40x40、60x60、80x80 ピクセル、72 Dpi と 300 Dpi を試しましたが、うまくいきませんでした。カスタムセルのコードは次のとおりです。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"MyCell";
//UILabel *mainLabel, *secondLabel, *thirdLabel;
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
cell.accessoryType = UITableViewCellAccessoryNone;
//Add the 3 labels
mainLabel = [[UILabel alloc] initWithFrame:CGRectMake(40.0, 5.0, 180.0, 21.0)];
mainLabel.tag = MAINLABEL_TAG;
//mainLabel.font = [UIFont systemFontOfSize:14.0];
//mainLabel.font = [UIFont fontWithName:@"Geeza Pro Bold" size:17.0];
mainLabel.font = [UIFont boldSystemFontOfSize:13];
mainLabel.textAlignment = UITextAlignmentLeft;
mainLabel.textColor = [UIColor blackColor];
mainLabel.highlightedTextColor = [UIColor whiteColor];
mainLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[cell.contentView addSubview:mainLabel];
secondLabel = [[UILabel alloc] initWithFrame:CGRectMake(40.0, 21.0, 190.0, 21.0)];
secondLabel.tag = SECONDLABEL_TAG;
//secondLabel.font = [UIFont systemFontOfSize:12.0];
//secondLabel.font = [UIFont fontWithName:@"Geeza Pro" size:15.0];
secondLabel.font = [UIFont systemFontOfSize:13];
secondLabel.textAlignment = UITextAlignmentLeft;
secondLabel.textColor = [UIColor darkGrayColor];
secondLabel.highlightedTextColor = [UIColor whiteColor];
secondLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[cell.contentView addSubview:secondLabel];
thirdLabel = [[UILabel alloc] initWithFrame:CGRectMake(240.0, 11.0, 70.0, 21.0)];
thirdLabel.tag = THIRDLABEL_TAG;
//thirdLabel.font = [UIFont systemFontOfSize:12.0];
//thirdLabel.font = [UIFont fontWithName:@"Geeza Pro Bold" size:17.0];
thirdLabel.font = [UIFont boldSystemFontOfSize:13];
thirdLabel.textAlignment = UITextAlignmentRight;
thirdLabel.textColor = [UIColor blackColor];
thirdLabel.highlightedTextColor = [UIColor whiteColor];
thirdLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[cell.contentView addSubview:thirdLabel];
}
else
{
mainLabel = (UILabel *)[cell.contentView viewWithTag:MAINLABEL_TAG];
secondLabel = (UILabel *)[cell.contentView viewWithTag:SECONDLABEL_TAG];
thirdLabel = (UILabel *)[cell.contentView viewWithTag:THIRDLABEL_TAG];
}
//If the requesting table view is the search display controller's table view, configure the cell using the filtered content, otherwise use the main list.
Car *car = nil;
if (tableView == self.searchDisplayController.searchResultsTableView)
{
car = [self.filteredListContent objectAtIndex:indexPath.row];
}
else
{
car = [self.listContent objectAtIndex:indexPath.row];
}
NSString *carName = [NSString stringWithFormat:@"%@",car.deviceName];
NSString *carDetails = [NSString stringWithFormat:@"%@ at %@",car.date,car.location];
NSString *carSpeed = [NSString stringWithFormat:@"%@ km/h",car.speed];
mainLabel.text = carName;
secondLabel.text = carDetails;
thirdLabel.text = carSpeed;
//Check for selection
if (car.isSelected == YES)
{
[cell.imageView setImage:[UIImage imageNamed:@"new_checkmark.png"]];
}
else
{
[cell.imageView setImage:nil];
}
return cell;
}
そして、ここにスクリーンショットがあります: