当我为 IKBrowserView 设置背景时,背景会根据视图大小调整大小:有没有办法将其设置为平铺图像,重复但从不调整大小?
NSImage* backgroundImage = [NSImage imageNamed:@"wood-bg2.jpg"];
CALayer* aLayer = [CALayer layer];
//aLayer.contents = backgroundImage;
CIColor *ci = [[CIColor alloc] initWithColor:[NSColor colorWithPatternImage:backgroundImage]];
CGColorSpaceRef cs = [ci colorSpace];
const CGFloat *comps = [ci components];
CGColorRef cgColor = CGColorCreate(cs, comps);
aLayer.backgroundColor = cgColor;
[itemThumbnailImageBrowserView setBackgroundLayer:aLayer];
我已经尝试了注释掉的代码和当前代码,但都没有工作。谢谢