1
istudiez proのアプリを見たことがありますか?これは私がこれまで行ってきたことですが、テキストテストは表示されません。理由は分かりませんか?実際の日付に変更する動的なカレンダーのタブバーのアイコン
@implementation TabBarIcon
CGContextRef CGBitmapContextCreate (
void *data,
size_t width,
size_t height,
size_t bitsPerComponent,
size_t bytesPerRow,
CGColorSpaceRef colorspace,
CGBitmapInfo bitmapInfo
);
-(void)drawRect:(CGRect)Rect{
CGImageRef context = UIGraphicsGetCurrentContext();
CGContextSetTextDrawingMode(context, kCGTextStroke);
CGContextSetRGBFillColor(context, 1.0, 0.0, 0.0, 1.0);
CGContextSelectFont(context, "Arial", 12.0, kCGEncodingMacRoman);
CGAffineTransform transform = CGAffineTransformMake(1.0, 0.0, 0.0, -1.0, 0.0, 0.0);
CGContextSetTextMatrix(context, transform);
CGContextShowTextAtPoint(context, 100.0, 100.0, "test", strlen("test"));
}
CGImageRef CGBitmapContextCreateImage(CGContextRef context);
@end
おかげ
ありがとうyh私はiosのために開発していますので、2番目の方法は、私が実際にコアグラフィックを全く使用していないことを除いてもっと簡単になると思っています。 – Dangermouse
それほど難しいことではありません。 [CGBitmapContext](http://developer.apple.com/library/ios/#documentation/GraphicsImaging/Reference/CGBitmapContext/Reference/reference.html)を作成し、[CGContext関数](http:// developerを使用します。実際の描画を行うにはapple.com/library/ios/#documentation/GraphicsImaging/Reference/CGContext/Reference/reference.html)、イメージを取得するには 'CGBitmapContextCreateImage'を実行します。 – Anomie
また、[UIKitのグラフィック関数](http://developer.apple.com/library/ios/#documentation/uikit/reference/UIKitFunctionReference/Reference/reference.html)を使うこともできます使用する。 – Anomie