热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

UITableView上的sendSubviewToBack在iOS11中无法正常工作

如何解决《UITableView上的sendSubviewToBack在iOS11中无法正常工作》经验,请帮忙看看怎么搞?

我有一个UITableViewController我通过将新添加的子视图发送回来成功应用于过去的渐变背景:

//performed on viewDidLoad
UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 1.5*280, 1.5*SCREEN_HEIGHT)];
bgView.backgroundColor = [UIColor yellowColor];
CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = bgView.bounds;
gradient.startPoint = CGPointMake(0, 0);
gradient.endPoint = CGPointMake(1, 1);
UIColor *topColor = UIColorFromRGB(0x229f80);
UIColor *bottomColor = UIColorFromRGB(0x621ad9);
gradient.colors = [NSArray arrayWithObjects:(id)[topColor CGColor], (id)[bottomColor CGColor], nil];
[bgView.layer insertSublayer:gradient atIndex:0];
[self.view addSubview:bgView];
[self.view sendSubviewToBack:bgView];
bgView = nil;

但是,这在iOS 11中不再有效,而bgView实际上放在所有单元格的顶部.

在此输入图像描述

谁知道我怎么解决这个问题?或者也许我一直都在做错?


推荐阅读
author-avatar
VASTEw
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有