我是iPhone编程的初学者,为了在Quartz和UIKit中学习,我想在电话屏幕上画一条线。如何开始绘图?
                    
                    
                2 回答
 
                    
                    
                            哈士奇WWW
                            
                                
                            
                        
                        
                                                
                    TA贡献1799条经验 获得超6个赞
您也可以使用绘制一条线UIBezierPath。下面将绘制垂直居中的水平线:
- (void)drawRect:(CGRect)rect {
CGFloat rectHeight = CGRectGetHeight(rect);
CGFloat rectWidth = CGRectGetWidth(rect);
UIBezierPath *line = [UIBezierPath bezierPath];
[line moveToPoint:CGPointMake(0, rectHeight / 2)];
[line addLineToPoint:CGPointMake(rectWidth, rectHeight / 2)];
[[UIColor lightGrayColor] setStroke];
[line stroke];
}
分享编辑
- 2 回答
- 0 关注
- 641 浏览
添加回答
举报
0/150
	提交
		取消
	