- - (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 ,这里我就不多说了!- // 通过<span style="font-family: 'Microsoft YaHei'; ">UINib 加载xib资源文件</span>
- UINib *hoverViewXib = [UINib nibWithNibName:@"xxxx" bundle:nil];
- [hoverViewXib instantiateWithOwner:self options:nil];