CAShapeLayer + UIBezierPath = sectionView
来源:互联网 发布:淘宝复刻鞋店 编辑:程序博客网 时间:2024/05/21 11:37
直接看看这块代码。
其实可以发现,
CAShapeLayer *_layerRight;
UIBezierPath *_pathLeft;
#import <UIKit/UIKit.h>
@interface XWSectionPlatView : UIView
@property (nonatomic,strong)UIColor *leftColor;
@property (nonatomic,strong)UIColor *rightColor;
@property (nonatomic,assign)CGFloat leftSpan;
@end
#import "XWSectionPlatView.h"
@implementation XWSectionPlatView
{
CAShapeLayer *_layerLeft;
CAShapeLayer *_layerRight;
UIBezierPath *_pathLeft;
UIBezierPath *_pathRight;
}
- (instancetype)initWithFrame:(CGRect)frame
{
self = [superinitWithFrame:frame];
if (self) {
_leftSpan =self.frame.size.width * 0.25;
_layerLeft = [[CAShapeLayeralloc]init];
_layerRight = [[CAShapeLayeralloc]init];
_layerLeft.fillColor =nil;
_layerRight.fillColor =nil;
_layerLeft.frame =self.bounds;
_layerRight.frame =self.bounds;
self.backgroundColor = [UIColorblueColor];
}
returnself;
}
- (void)setLeftLayer{
_pathLeft = [UIBezierPathbezierPathWithRect:CGRectMake(0, 0,_leftSpan, self.frame.size.height)];
_layerLeft.path =_pathLeft.CGPath;
}
- (void)setRightLayer{
_pathRight = [UIBezierPathbezierPathWithRect:CGRectMake(_leftSpan, 0,self.frame.size.width - _leftSpan, self.frame.size.height)];
}
- (void)setLeftSpan:(CGFloat)leftSpan {
_leftSpan = leftSpan;
[selfsetRightLayer];
[selfsetLeftLayer];
}
- (void)setRightColor:(UIColor *)rightColor {
_layerRight.fillColor = rightColor.CGColor;
[selfsetRightLayer];
}
- (void)setLeftColor:(UIColor *)leftColor {
_layerLeft.fillColor = leftColor.CGColor;
[selfsetLeftLayer];
}
@end
- CAShapeLayer + UIBezierPath = sectionView
- CAShapeLayer UIBezierPath
- CAShapeLayer与UIBezierPath
- UIBezierPath和CAShapeLayer简介
- 使用CAShapeLayer与UIBezierPath
- CAShapeLayer与UIBezierPath
- CAShapeLayer与UIBezierPath
- CAShapeLayer和UIBezierPath
- ios CAShapeLayer和UIBezierPath
- IOS_ UIBezierPath + CABasicAnimation + CAShapeLayer
- CAShapeLayer与UIBezierPath
- 一:UIBezierPath和CAShapeLayer简介
- UIBezierPath 和 CAShapeLayer 画画图
- UIBezierPath+CAShapeLayer 绘制自定义图形
- CAShapeLayer与UIBezierPath绘制图形
- UIBezierPath + CAShapeLayer (弧形 + 线条)
- iOS CAShapeLayer和UIBezierPath绘图
- UIBezierPath和CAShapeLayer 阅读笔记
- OSG+VS2015+Win10配置
- DES/3DES/AES区别
- IOS 打包成Ipa 文件
- iOS学习应用开发就业课_009:UIViewController的使用
- Redis-实现Session同步
- CAShapeLayer + UIBezierPath = sectionView
- Linux防火墙(iptables)关闭与开启配置
- Q_PROPERTY
- C语言队列的顺序表示
- 多核系统中温度隐蔽通道的带宽优化
- volatile用法详解
- 微信开放平台微信登录授权的说明
- IP首部校验和的算法
- 异或运算的意义