Vì vậy, tôi đã xem qua các bài viết khác nhau về cách thêm chế độ xem thứ 2 để thêm bóng, nhưng tôi vẫn không thể làm cho nó hoạt động nếu tôi muốn thêm nó vào UICollectionViewCell. Tôi đã phân lớp UICollectionViewCellvà đây là mã của tôi, nơi tôi thêm các phần tử giao diện người dùng khác nhau vào chế độ xem nội dung của ô và thêm bóng vào lớp:
[self.contentView setBackgroundColor:[UIColor whiteColor]];
self.layer.masksToBounds = NO;
self.layer.shadowOffset = CGSizeMake(0, 1);
self.layer.shadowRadius = 1.0;
self.layer.shadowColor = [UIColor blackColor].CGColor;
self.layer.shadowOpacity = 0.5;
[self.layer setShadowPath:[[UIBezierPath bezierPathWithRect:self.bounds] CGPath]];
Tôi muốn biết cách thêm góc tròn và bóng đổ vào UICollectionViewCell.