我是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 關注
- 644 瀏覽
添加回答
舉報
0/150
提交
取消
