阴影未显示在 iOS 中的单元格上 [英] Shadow not showing on cell in iOS
本文介绍了阴影未显示在 iOS 中的单元格上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 UICollectionView 在主视图中生成多个缩略图.
I am using UICollectionView to generate several thumbnails in a Master View.
这很好用,我可以在单元格周围放置边框并应用边框(角)半径.
This works fine and I am able to place a border around the cells as well as apply border (corner) radius.
唯一似乎不粘的是每个单元格的阴影.
The only thing that does not seem to stick is the shadow for each cell.
这是我的代码
....
[cell.layer setBorderColor:[UIColor colorWithRed:213.0/255.0f green:210.0/255.0f blue:199.0/255.0f alpha:1.0f].CGColor];
[cell.layer setBorderWidth:1.0f];
[cell.layer setCornerRadius:7.5f];
[cell.layer setShadowOffset:CGSizeMake(0, 1)];
[cell.layer setShadowColor:[[UIColor darkGrayColor] CGColor]];
[cell.layer setShadowRadius:8.0];
[cell.layer setShadowOpacity:0.8];
return cell;
你知道我做错了什么以及我可以做些什么让阴影显示出来吗?
Do you know what I'm doing wrong and what I can do for the shadow to show?
推荐答案
需要启用阴影在边界外创建;
You need to enable the shadow to be created outside of the bounds;
[cell.layer setMasksToBounds:NO];
[cell.layer setMasksToBounds:NO];
这篇关于阴影未显示在 iOS 中的单元格上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文