0
여러 이미지 하위 레이어가있는 UIImageView 하위 클래스 인스턴스가 있습니다.(iphone) 이미지 뒤에 검은 사각형이 나타납니다. 이유는 무엇입니까?
이보기에 그림자를 동적으로 추가/제거하고 싶습니다.
다음 코드는 하나의 하위 레이어가있는 imageView에 잘 작동하지만 (imageView 하위 클래스의 구현) 여러 하위 레이어가있는 imageView의 경우 그림자 대신 검은 색 사각형을 표시합니다.
- (void) drawLayer: (CALayer*) layer inContext: (CGContextRef)context
{
SYSLOG(LOG_DEBUG, "in drawLayer, isShadowed: %d", isShadowed);
if(isShadowed == true)
{
CGContextSaveGState(context);
CGContextClearRect(context, self.bounds);
CGContextSetShadow(context, CGSizeMake(10, 10), 3);
CGContextBeginTransparencyLayer(context, NULL);
[layer renderInContext:context];
CGContextEndTransparencyLayer(context);
CGContextRestoreGState(context);
}
else
{
[layer renderInContext:context];
}
}
당신에게