iOS 11/Xcode 9:删除时,UITableViewCell白色背景闪烁 [英] iOS 11/Xcode 9: UITableViewCell white background flickers on delete

查看:69
本文介绍了iOS 11/Xcode 9:删除时,UITableViewCell白色背景闪烁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在iOS 11设备上,删除UITableViewCell时,由于某种原因会出现意外的白色背景,但是所有背景颜色在情节提要中都设置为蓝色(在iOS10上运行良好).

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];
    }
}

尝试了所有类型的 UITableViewRowAnimation ,不能解决问题.

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

推荐答案

尝试一下(您可以选择AppearanceWhenContainedInInstancesOfClasses代替).

Try it (you can choose appearanceWhenContainedInInstancesOfClasses instead).

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

    ...

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

    return YES;
}

这篇关于iOS 11/Xcode 9:删除时,UITableViewCell白色背景闪烁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆