自定义一个view,在里面划线添加ui
#import "BeazView.h"
@implementation BeazView
-(instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self) {
[self dosomething];
}
return self;
}
-(void)dosomething{
_bezierPath4 = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(10, 20, self.frame.size.width-20, 100) byRoundingCorners:UIRectCornerAllCorners
cornerRadii:CGSizeMake(10, 10)];
[_bezierPath4 moveToPoint:CGPointMake(100, 0)];
[_bezierPath4 addLineToPoint:CGPointMake(80, 20)];
[_bezierPath4 addLineToPoint:CGPointMake(120, 20)];
_shaperLayer4 = [CAShapeLayer new];
_shaperLayer4.fillColor = [UIColor orangeColor].CGColor;
[self.layer addSublayer:_shaperLayer4];
_shaperLayer4.path = _bezierPath4.CGPath;
_title = [[UILabel alloc]initWithFrame:CGRectMake(10, 20, self.frame.size.width-20, 100)];
_title.text = @"我在上面";
_title.textColor = [UIColor redColor];
[self addSubview:_title];
}
定义一个按钮,实现移除
[UIView animateWithDuration:0.02 animations:^{
[view removeFromSuperview];
} completion:^(BOOL finished) {
}];