This question already has an answer here:
(1) How to fix UITableView separator on iOS 7?
I met the same question as iOS: UIImageView changes with change in UITableView.rowHeight, how to avoid? described, of course, in SO, there were many Q/As like this, and I tried many answers, but I did not get the right result:
(1) when in ...cellForRowAtIndexPath...
:
NSString *CellIdentifier = [menuItems objectAtIndex:indexPath.row];
NSString *CellLabel = [menuLabels objectAtIndex:indexPath.row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
cell.textLabel.text = CellLabel;
tableView.rowHeight = 43;
UIImage* im = [UIImage imageNamed: @"news"];
cell.imageView.image = im;
I got the following:
(2) I tried the above answer: based on (1)'s code, I added:
UIGraphicsBeginImageContextWithOptions(CGSizeMake(32,32), YES, 0);
[im drawInRect:CGRectMake(0,0,32,32)];
UIImage* im2 = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
cell.imageView.image = im2;
cell.imageView.contentMode = UIViewContentModeCenter;
I got another strange picture:
Append:
I hope I got the following result:
here is a continual line under the icon