- (void)setImageL {
UIBezierPath * path = [UIBezierPath bezierPath];
path.lineWidth = 4;
[path moveToPoint:CGPointMake(0,0)];
[path addLineToPoint:CGPointMake(kScreen_Width /4, 0)];
[path addLineToPoint:CGPointMake(kScreen_Width/5, 200)];
[path addLineToPoint:CGPointMake(0, 200)];
[path closePath];
CAShapeLayer * shapLayer = [CAShapeLayer layer];
shapLayer.lineWidth = 2;
shapLayer.path = path.CGPath;
self.layer.mask = shapLayer;
}
- (void)setimageH {
UIBezierPath * path = [UIBezierPath bezierPath];
path.lineWidth = 4;
[path moveToPoint:CGPointMake(kScreen_Width /4, 0)];
[path addLineToPoint:CGPointMake(3*kScreen_Width/7, 0)];
[path addLineToPoint:CGPointMake(kScreen_Width/2, 200)];
[path addLineToPoint:CGPointMake(kScreen_Width/5, 200)];
[path closePath];
CAShapeLayer * shapLayer = [CAShapeLayer layer];
shapLayer.lineWidth = 2;
shapLayer.path = path.CGPath;
self.layer.mask = shapLayer;
}
- (void)setimageT{
UIBezierPath * path = [UIBezierPath bezierPath];
path.lineWidth = 4;
[path moveToPoint:CGPointMake(3kScreen_Width/7, 0)];
[path addLineToPoint:CGPointMake(3kScreen_Width/4, 0)];
[path addLineToPoint:CGPointMake(kScreen_Width/2+kScreen_Width/5, 200)];
[path addLineToPoint:CGPointMake(kScreen_Width/2, 200)];
[path closePath];
CAShapeLayer * shapLayer = [CAShapeLayer layer];
shapLayer.lineWidth = 2;
shapLayer.path = path.CGPath;
self.layer.mask = shapLayer;
}
- (void)setimageF{
UIBezierPath * path = [UIBezierPath bezierPath];
path.lineWidth = 4;
[path moveToPoint:CGPointMake(kScreen_Width, 0)];
[path addLineToPoint:CGPointMake(3*kScreen_Width/4, 0)];
[path addLineToPoint:CGPointMake(kScreen_Width/2+kScreen_Width/5, 200)];
[path addLineToPoint:CGPointMake(kScreen_Width, 200)];
[path closePath];
CAShapeLayer * shapLayer = [CAShapeLayer layer];
shapLayer.lineWidth = 2;
shapLayer.path = path.CGPath;
self.layer.mask = shapLayer;
调用
oneimage = [[UIImageView alloc]init];
oneimage.frame = CGRectMake(0, 0, kScreen_Width , 200);
oneimage.image = [UIImage imageNamed:@"cm2_daily_banner1.jpg"];
[oneimage setImageL];
[kindview addSubview:oneimage];
oneimage.tag = 11;
oneimage.userInteractionEnabled = YES;
}