0
我想要創建一個自定義進度視圖,該視圖在用戶按下按鈕時進行並在釋放按鈕時停止。 一個空白的子視圖代表了進度的背景,我畫了一個方塊作爲起點。 空白視圖應該被填充,直到按鈕被釋放爲止。如何繼續填充視圖直到按鈕被釋放?如何使用Core Graphics繪製進度視圖
這裏是我的代碼:
CGContextRef context=UIGraphicsGetCurrentContext();
CGContextSetLineWidth(context, 2.0);
CGContextSetStrokeColorWithColor(context, [UIColor blueColor].CGColor);
CGRect square=CGRectMake(0, 0, 5, 9);
CGContextAddRect(context, square);
CGContextStrokePath(context);
CGContextSetFillColorWithColor(context, [UIColor blueColor].CGColor);
CGContextFillRect(context, square);
在視圖控制器的viewDidLoad
SeekBar *seek=[[SeekBar alloc]initWithFrame:CGRectMake(0, 320, 320, 9)];
[self.view addSubview:seek];
我在覈心graphics.Is這種正確的做法是新手?
難道這個不斷解決問題了嗎? –