开发者

UIImage with drawInRect

i have an app [window based]that I need to "draw" some images in the screen, [I开发者_JS百科m following a sample project that implements some custom chart drawings, doing this, but it doesn't use UIImage view, just UIImage)

im using

- (void)viewDidLoad
 {
[super viewDidLoad];
self.view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
self.view.backgroundColor = [UIColor grayColor];

UILabel *labelA = [[[UILabel alloc] initWithFrame:CGRectMake(100, 100, 100, 20)]autorelease];

[self.view addSubview: labelA];

labelA.text = @"mk ss9";

[MyClassic pongalo];


int i = [MyClassic numero];
NSLog(@"el nuro :%d",i);

[MyClassic suma1:343];



int y = [MyClassic sumatoria:11 :12]; 
NSLog(@"suma = %d",y);

[self dicto];


UIImage *img = [UIImage imageNamed:@"line.png"];
[img drawInRect: CGRectMake(12, 12, 12, 200) ];

}

but the image is not showing, label is showing fine

Im also getting this errors in console:

  CGContextSaveGState: invalid context 0x0
  CGContextSetBlendMode: invalid context 0x0
  CGContextSetAlpha: invalid context 0x0
  CGContextTranslateCTM: invalid context 0x0
  CGContextScaleCTM: invalid context 0x0
  CGContextDrawImage: invalid context 0x0
  CGContextRestoreGState: invalid context 0x0

how to fix this?

thanks a lot!


It seems that in the above examples use CoreGraphics and draws at the CGContextRef in drawRect function. May be this helps you: How to draw an UIImage or directly in -drawRect:?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜