I want to add a checkerboard background to an IKImageView for viewing transparent images. I am trying to set CALayer with checkboard image to IKImageView with message setOverlay:forType
CFURLRef imageURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(),(CFStringRef)@"bgImage.png", NULL, NULL);
CGImageSourceRef imageSource = CGImageSourceCreateWithURL(imageURL,NULL);
CFRelease(imageURL);
CGImageRef image = CGImageSourceCreateImageAtIndex(imageSource, 0,NULL);
CFRelease(imageSource);
CALayer *bgLayer = [[CALayer alloc] init ];
[bgLayer setContents:image ];
[ imageView setOverlay:bgLayer forType:IKOverlayTypeBackground ];
but doesn't work. I get this message in console
could not add '<CALayer: 0x101d039a0>' linkedTo 'kIKRootLayerType'
Does anyone knows what is wrong or any workarround ?
Thanks