0
這非常簡單,但我無法弄清楚我做錯了什麼。iOS - 在視圖控制器中繪製甜甜圈
我有一個視圖控制器,在中心有一個視圖。我想畫的東西像下面的循環:
我遇到的主要問題,是我不能讓anytihng露面的看法。我現在只是想畫一條線,但我顯然錯過了一些關鍵。這裏是我的代碼:
@interface ViewController()
@property (weak, nonatomic) IBOutlet UIView *centerView;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
[[UIColor brownColor] set];
CGContextRef currentContext =UIGraphicsGetCurrentContext();
CGContextSetLineWidth(currentContext,5.0f);
CGContextMoveToPoint(currentContext,50.0f, 10.0f);
CGContextAddLineToPoint(currentContext,100.0f, 200.0f);
CGContextStrokePath(currentContext);
}
這裏有很多基礎知識。從[適用於iOS的繪圖和打印指南]開始(https://developer.apple.com/library/prerelease/content/documentation/2DDrawing/Conceptual/DrawingPrintingiOS/Introduction/Introduction.html#//apple_ref/doc/uid/TP40010156 ), 也許? – rickster
或者你可以從https://github.com/kirualex/KAProgressLabel –
開始我喜歡UIBezierPath in drawRect: – Alex