我正在使用OpenGL开发绘画应用程序。
我正在使用“ CUSTOM UIView”在屏幕上绘图,并使用另一个UIImageView为其设置背景图像。看一下屏幕截图以清楚地理解它。我的问题是我无法在任一视图上设置背景图像。我必须使用不同的纹理作为必须在其上绘画的绘图板。谁能建议这种方法不正确?
我已将此代码用于自定义UIView,但未获得成功..但是它仅显示白色默认背景。
- (id)initWithCoder:(NSCoder*)coder {
UIColor *background = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"Rough_White_Paper_with_tape.png"]];
self.backgroundColor = background;
[background release];
}
NSURL *imgUrl=[[NSURL alloc] initWithString:@"http://img835.imageshack.us/img835/9794/screenshot20110802at345.png"];
NSData *imgData = [NSData dataWithContentsOfURL:imgUrl];
UIImage *img = [UIImage imageWithData:imgData];
imageView = [[UIImageView alloc] initWithImage:img];
[self addSubview:imageView ];
[self sendSubviewToBack:imageView ];
[imageView release]; [imgUrl release];
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句