我有一个 UICollectionView,我正在使用此代码(在 UICollectionViewCell 的子类中)在选择单元格时添加边框:
- (void)isSelected{
NSLog(@"selected");
[self.layer setBorderColor:[UIColor colorWithRed:213.0/255.0f green:210.0/255.0f blue:199.0/255.0f alpha:1.0f].CGColor];
[self.layer setBorderWidth:1.0f];
[self.layer setCornerRadius:9.5f];
}
- (void)isNotSelected{
NSLog(@"not selected");
[self.layer setBorderColor:[UIColor clearColor].CGColor];
[self setNeedsDisplay];
}
选择单元格时它确实有效,但取消选择时 id 无效。我可以看到两个通话的日志。
我怎样才能删除这个边框?
先感谢您