내 응용 프로그램에서는 배경이있는 IKImageBrowserView를 사용합니다. wantLayer NO - 괜찮아요, IKImageBrowserView가 멋지다. 그러나 (부모보기에서) wantLayer를 활성화하면 IKImageBrowserView의 배경이 손상됩니다. (미안 영어가 모국어가 아니기 때문에 정확한 단어를 찾을 수 없습니다.)background 및 wantsLayer가있는 IKImageBrowserView
정확하게 이해한다면이 부분의 문제입니다. 그러나 나는 어디에서 볼 수 없다.
NSRect visibleRect = [owner visibleRect];
NSRect bounds = [owner bounds];
CGImageRef image = NULL;
NSString *path = [[NSBundle mainBundle] pathForResource:[@"metal_background.tif" stringByDeletingPathExtension] ofType:[@"metal_background.tif" pathExtension]];
if (!path) {
return;
}
CGImageSourceRef imageSource = CGImageSourceCreateWithURL((__bridge CFURLRef)[NSURL fileURLWithPath:path], NULL);
if (!imageSource) {
return;
}
image = CGImageSourceCreateImageAtIndex(imageSource, 0, NULL);
if (!image) {
CFRelease(imageSource);
return;
}
float width = (float) CGImageGetWidth(image);
float height = (float) CGImageGetHeight(image);
//compute coordinates to fill the view
float left, top, right, bottom;
top = bounds.size.height - NSMaxY(visibleRect);
top = fmod(top, height);
top = height - top;
right = NSMaxX(visibleRect);
bottom = -height;
// tile the image and take in account the offset to 'emulate' a scrolling background
for (top = visibleRect.size.height-top; top>bottom; top -= height){
for(left=0; left<right; left+=width){
CGContextDrawImage(context, CGRectMake(left, top, width, height), image);
}
}
CFRelease(imageSource);
CFRelease(image);
감사
흥미롭지 만 지금은 내 경우에 도움이됩니다. – user3229853