【发布时间】:2011-08-30 16:31:05
【问题描述】:
我有一个[基于窗口]的应用程序,我需要在屏幕上“绘制”一些图像,[我正在关注一个实现一些自定义图表绘图的示例项目,这样做,但它不使用 UIImage 视图,只是UIImage)
我正在使用
- (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) ];
}
但图片没有显示,标签显示正常
我也在控制台中收到此错误:
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
如何解决这个问题?
非常感谢!
【问题讨论】: