此代码在 iOS7 中有效,但在 iOS6 模拟器中运行时,应该在子层之上的单元格将在它们之下。
bgLayer = [BackgroundLayer gradientFromColor:COLOR_MID_GRADIENT to:COLOR_GRADIENT];
CGRect bottom = self.view.bounds;
bottom.origin.y = self.view.bounds.size.height-GRADIENT_HEIGHT;
bottom.size.height = GRADIENT_HEIGHT;
bgLayer.frame = bottom;
[self.view.layer insertSublayer:bgLayer atIndex:1];
它的作用是将渐变层放在带有 tableview 的视图的底部。
但是,渐变矩形中的单元格将隐藏在其后面!
我试图更改索引,但它没有做任何事情。此外, insertSublayer: below: 也不起作用。
我错过了什么?如何将图层放在表格视图单元格下方?
谢谢。