2011-07-04 1 views
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

おかげ

答えて

2

私はistudiezプロに慣れていないんだけど、それは日によって異なるタブバーの画像を割り当てるだけの問題だように聞こえます。あなたはiOSやOSXを対象としているかどうかは言及していませんが、前者の場合、適切なイメージで作成されたUITabBarItemのインスタンスを作成し、適切なUIViewControllerのtabBarItemに割り当てます。

「月の日」の場合、31個の可能な画像すべてを含めることができます。そうでない場合、実行時にCore Graphicsを使用して適切な画像を描画できます。

+0

ありがとうyh私はiosのために開発していますので、2番目の方法は、私が実際にコアグラフィックを全く使用していないことを除いてもっと簡単になると思っています。 – Dangermouse

+0

それほど難しいことではありません。 [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

+0

また、[UIKitのグラフィック関数](http://developer.apple.com/library/ios/#documentation/uikit/reference/UIKitFunctionReference/Reference/reference.html)を使うこともできます使用する。 – Anomie

関連する問題