1
클리핑, 나는 아래와 같이 반경 사용자 정의 그림자를 만들 drawTextInRect 방법을 변경 :UIButton.titleLabel 그림자
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
float colorValues[] = {0, 0, 0, opacity};
CGColorRef shadowColor = CGColorCreate(colorSpace, colorValues);
CGSize shadowOffset = CGSizeMake(offsetX, offsetY);
CGContextSetShadowWithColor (context, shadowOffset, radius, shadowColor);
이 잘 작동합니다. 그것은 그림자를 만듭니다. 나는 titleLabel의 경계를 변경하고 같은 drawTextInRect 방법이라고 : 때문에 titleLabel 경계의
button.titleLabel.bounds = CGRectMake(button.titleLabel.bounds.origin.x, button.titleLabel.bounds.origin.y, button.titleLabel.bounds.size.width, button.titleLabel.bounds.size.height);
[button.titleLabel drawTextInRect:button.titleLabel.bounds];
[button setNeedsLayout];
, 그림자 클리핑된다.