我想在UIView中繪製圖像之間的圖像(如鏈接圖像..)。我已經使用在2個圖像視圖之間在UIView中繪製一條線
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetStrokeColorWithColor(context, [UIColor redColor].CGColor);
CGContextSetLineWidth(context, 2.0);
CGContextMoveToPoint(context, 0,0); //start at this point
CGContextAddLineToPoint(context, 20, 20); //draw to this point
CGContextStrokePath(context);
但是在這裏,我的上下文爲空。我不知道我是否必須導入任何框架或導入任何標題。任何建議或樣本將不勝感激。
在此先感謝。
,你已經寫了這個代碼? – Iducool 2012-07-23 07:45:25
你必須導入Quartz框架,並在頭文件中寫入:'#import',但如果你沒有導入它,那麼你會得到編譯器錯誤,所以這可能不是問題。 –
pasawaya
2012-07-23 07:49:00
我建議你閱讀這篇文章http://stackoverflow.com/questions/5847876/whats-the-best-approach-to-draw-lines-between-views – Peres 2012-07-23 07:54:19