标签:图片切正圆 uilabel文字底部画一条线 自定义view的半透明渐变效果
1.图片头像切成圆【不是半径的话 不是正圆】
self.imgvHead.clipsToBounds = YES;
self.imgvHead.layer.cornerRadius = self.imgvHead.bounds.size.height/2;
self.imgvHead.layer.borderWidth = 0.5f;
self.imgvHead.layer.borderColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.3].CGColor;
2.UILabel底部显示一条线
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:self.lblCheckDetail.text];
NSRange strRange = {0,[str length]};
[str addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:strRange];
[self.lblCheckDetail setAttributedText:str];
3.自定义一个透明度渐变的效果
UIColor *colorOne = [UIColor colorWithRed:(33/255.0) green:(33/255.0) blue:(33/255.0) alpha:0.0];
UIColor *colorTwo = [UIColor colorWithRed:(33/255.0) green:(33/255.0) blue:(33/255.0) alpha:1.0];
NSArray *colors = [NSArray arrayWithObjects:(id)colorOne.CGColor, colorTwo.CGColor, nil];
NSNumber *stopOne = [NSNumber numberWithFloat:0.0];
NSNumber *stopTwo = [NSNumber numberWithFloat:1.0];
NSArray *locations = [NSArray arrayWithObjects:stopOne, stopTwo, nil];
CAGradientLayer *headerLayer = [CAGradientLayer layer];
headerLayer.colors = colors;
headerLayer.locations = locations;
CGFloat width = self.viewGradualAlpha.bounds.size.width + SCREEN_WIDTH - self.cellimgvTop.bounds.size.width;
CGFloat height= self.viewGradualAlpha.bounds.size.height;
headerLayer.frame = CGRectMake(0, 0, width, height);
[self.viewGradualAlpha.layer insertSublayer:headerLayer atIndex:0];
版权声明:本文为博主原创文章,未经博主允许不得转载。
图片切圆,label文字底部加一条线,自定义view的透明度渐变效果
标签:图片切正圆 uilabel文字底部画一条线 自定义view的半透明渐变效果
原文地址:http://blog.csdn.net/luobo140716/article/details/47293643