这里是我到目前为止的代码(在抽签RECT):绘制到NSImage中的子类的NSView
// Drawing code here.
NSLog(@"%@", [[NSBundle mainBundle] pathForResource:@"NoiseBGMainView" ofType:@"jpg"]);
NSURL *pathToBGImage = [[NSURL alloc] initWithString:[[NSBundle mainBundle] pathForResource:@"NoiseBGMainView" ofType:@"jpg"]];
NSImage *NoiseBGMainView = [[NSImage alloc] initWithContentsOfURL:pathToBGImage];
[NoiseBGMainView drawInRect:[self bounds] fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1];
而且图像不画......我不知道什么是错的事。
您是否证明'noiseBGMainView'不是'nil'? – 2010-02-05 03:53:40
我该如何检查? – nanochrome 2010-02-05 04:21:03
NSLog它,就像你做URL一样。 – 2010-02-05 04:27:13