【发布时间】:2010-02-06 10:25:13
【问题描述】:
到目前为止,这是我的代码(在绘图矩形中):
// 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了吗? -
NSLog 它,就像你做 URL 一样。
标签: objective-c cocoa drawing nsview