- 授权协议: 未知
- 开发语言: Objective-C
- 操作系统: 跨平台
- 软件首页: https://github.com/gitKun/DRCornerViewExtension
- 软件文档: https://github.com/gitKun/DRCornerViewExtension
- 官方下载: https://github.com/gitKun/DRCornerViewExtension
软件介绍
DRCornerViewExtension是一款设置圆角的方式,无离屏渲染,无mask 使用 CAShaperLayer 实现 Extension的软件。
使用 maskToBounds 和 cornerRadius 或者 mask 时 造成的离屏渲染(如下图):
使用 UIView+Corner 时的UIImageView
使用 UIView+Corner 时的UILabel
核心代码:
- (void)dr_cornerWithRadius:(CGFloat)radius backgroundColor:(UIColor *)bgColor {
CGFloat width = CGRectGetWidth(self.bounds);
CGFloat height = CGRectGetHeight(self.bounds);
UIBezierPath * path= [UIBezierPath bezierPathWithRect:CGRectMake(0, 0, width, height)];
CAShapeLayer *shapeLayer = [CAShapeLayer layer];
if (radius == -1) {
radius = MIN(width, height)/2;
}
[path appendPath:[UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(radius, radius)]];
/*
字面意思是“奇偶”。按该规则,要判断一个点是否在图形内,从该点作任意方向的一条射线,然后检测射线与图形路径的交点的数量。如果结果是奇数则认为点在内部,是偶数则认为点在外部
*/
[path setUsesEvenOddFillRule:YES];
shapeLayer.path = path.CGPath;
shapeLayer.fillRule = kCAFillRuleEvenOdd;
shapeLayer.fillColor = bgColor.CGColor;
if ([self isKindOfClass:[UILabel class]]) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.layer addSublayer:shapeLayer];
});
return;
}
[self.layer addSublayer:shapeLayer];
}
算法技术手册
George T. Heineman、Gary Pollice、Stanley Selkow / 杨晨、李明 / 机械工业出版社 / 2010-3 / 55.00元
《算法技术手册》内容简介:开发健壮的软件需要高效的算法,然后程序员们往往直至问题发生之时,才会去求助于算法。《算法技术手册》讲解了许多现有的算法,可用于解决各种问题。通过阅读它,可以使您学会如何选择和实现正确的算法,来达成自己的目标。另外,书中的数学深浅适中,足够使您可以了解并分析算法的性能。 较之理论而言,《算法技术手册》更专注于应用。《算法技术手册》提供了高效的代码解决方案,使用多种语言......一起来看看 《算法技术手册》 这本书的介绍吧!



