您的位置:首页 > 产品设计 > UI/UE

利用UIBezierPath实现一个带圆角的视图

2013-07-12 12:02 316 查看
- (void)drawRect:(CGRect)rect
{
// draw a box with rounded corners to fill the view -
UIBezierPath *roundedRect = [UIBezierPath bezierPathWithRoundedRect:self.bounds cornerRadius:5.0f];
[[UIColor colorWithWhite:0.8 alpha:0.5] setFill];
[roundedRect fillWithBlendMode:kCGBlendModeNormal alpha:1];
}


UIBezierPath对象是CGPathRef数据类型的封装。path如果是基于矢量形状的,都用直线和曲线段去创建。我们使用直线段去创建矩形和多边形,使用曲线段去创建弧(arc),圆或者其他复杂的曲线形状。

 


UIBezierPath 的使用介绍  

详细的介绍了UIBezierPath ,这里我就不多说了!

// 通过UINib 加载xib资源文件
UINib *hoverViewXib = [UINib nibWithNibName:@"xxxx" bundle:nil];
[hoverViewXib instantiateWithOwner:self options:nil];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  UIBezierPath UINib