Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 11/Xcode 9: UITableViewCell white background flickers on delete

On iOS 11 device on deleting a UITableViewCell unexpected white background appears for some reason however all background colors are set to blue in storyboard (works fine on iOS10).

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (editingStyle == UITableViewCellEditingStyleDelete)
    {
        [self.bookmarks removeObjectAtIndex:indexPath.row];            
        [self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
    }
}

Tried all types of UITableViewRowAnimation, doesn't solve the problem.

enter image description here

like image 482
Pavel Kozlov Avatar asked Sep 28 '17 19:09

Pavel Kozlov


2 Answers

Try it (you can choose appearanceWhenContainedInInstancesOfClasses instead).

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    ...

    [[UITableViewCell appearance] setBackgroundColor:[UIColor clearColor]];

    return YES;
}
like image 185
Milch Avatar answered Oct 29 '22 01:10

Milch


I tried everything that's possible and only thing that work was

adding

UITableViewCell.appearance().backgroundColor = UIColor.clear

in didFinishLaunchingWithOptions

like image 27
Iraniya Naynesh Avatar answered Oct 29 '22 00:10

Iraniya Naynesh