0
我有一個應用程序[基於窗口],我需要在屏幕上「繪製」一些圖像,[我遵循一個示例項目,實現一些自定義圖表圖形,這樣做,但它不使用UIImage視圖,只是的UIImage)UIImage with drawInRect
IM使用
- (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
如何解決這一問題?
非常感謝!