我開發了使用NSObject類和使用CGContext方法的圖。下面的代碼在X軸和Y軸間隔動態顯示,如何在圖形x和y軸間隔點上書寫文字?
CGContextSetRGBStrokeColor(ctx, 2.0, 2.0, 2.0, 1.0);
CGContextSetLineWidth(ctx, 2.0);
CGContextMoveToPoint(ctx, 30.0, 200.0);
CGContextAddLineToPoint(ctx, 30.0, 440.0);
for(float y = 400.0; y >= 200.0; y-=30)
{
CGContextSetRGBStrokeColor(ctx, 2.0, 2.0, 2.0, 1.0);
CGContextMoveToPoint(ctx, 28, y);
CGContextAddLineToPoint(ctx, 32, y);
CGContextStrokePath(ctx);
//CGContextClosePath(ctx);
}
CGContextMoveToPoint(ctx, 10, 420.0);
CGContextAddLineToPoint(ctx, 320, 420.0);
//CGContextAddLineToPoint(ctx, 320.0, 420.0);
//CGContextStrokePath(ctx);
for(float x = 60.0; x <= 260.0; x+=30)
{
CGContextSetRGBStrokeColor(ctx, 2.0, 2.0, 2.0, 1.0);
CGContextMoveToPoint(ctx, x, 418.0);
CGContextAddLineToPoint(ctx, x, 422.0);
CGContextStrokePath(ctx);
CGContextClosePath(ctx);
}
欲寫在X和Y軸線的間隔接近所述動態文本(如X軸表示每個星期的天數Y軸表示每個東西的東西)? 謝謝。
喜史蒂夫·哈里森的標籤, 他們是appliaction .dmg文件。谷歌沒有提供給定鏈接的源代碼(核心圖)。 我想要源代碼亞教程就可以了。 – Tirth 2010-03-31 09:30:32
@Rajendra Bhole:如果您點擊鏈接頁面頂部的「源代碼」選項卡,您將進入可以瀏覽項目源代碼的頁面。它還具有關於如何使用Mercurial下載該框架的最新版本(包括多個示例iPhone應用程序)的說明。有關詳情,請參閱此頁面:http://code.google.com/p/core-plot/wiki/UsingMercurial和這一個:http://code.google.com/p/core-plot/wiki/UsingCorePlotInApplications – 2010-03-31 12:43:08