【发布时间】:2014-04-21 09:56:57
【问题描述】:
我正在尝试仅在右侧为 UITableViewCell 创建内部阴影。我就是这样的,
if (![cell viewWithTag:100]) {
UIView *shadowView = [[UIView alloc] initWithFrame:CGRectMake(DEVICE_WIDTH, 0, 10, height)];
shadowView.layer.shadowColor = [UIColor darkGrayColor].CGColor;
shadowView.layer.shadowRadius = 5.0;
shadowView.layer.shadowOffset = CGSizeMake(-2, 0);
shadowView.layer.shadowOpacity = 0.8;
shadowView.backgroundColor = [UIColor darkGrayColor];
shadowView.tag = 100;
shadowView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
[cell addSubview:self.shadowView];
}
但我的问题是每次滚动时阴影都会变暗。也会超出单元格边界并破坏单元格设计。我怀疑它会被反复添加。谁能帮我解决这个问题?我对使用图像作为阴影不感兴趣。因此,除了使用图像之外的任何其他解决方案都将受到赞赏。提前致谢。
【问题讨论】:
标签: ios objective-c uitableview shadow