You need to set the layer’s -maskToBounds: property to YES to clip.

Thanks,
Jon

> On Feb 7, 2015, at 10:38 PM, Aaron Lewis <the.warl0ck.1...@gmail.com> wrote:
> 
> Hi,
> 
> I'm trying to create a circular button, with an rectangular image:
> 
>    self.button.layer.borderColor  = [UIColor blackColor].CGColor;
>    self.button.layer.borderWidth  = 5;
>    self.button.layer.cornerRadius = self.button.bounds.size.width / 2.0;
>    [self.button setBackgroundImage: [UIImage
> imageNamed:@"avatar.jpeg"] forState:UIControlStateNormal];
> 
> But the framework doesn't seem to "clip" the rectangular image into a
> circular one.
> All extra parts are displayed on screen.
> 
> Did I get this wrong? Am I expected to use only circular images?
> 
> 
> -- 
> Best Regards,
> Aaron Lewis - PGP: 0x13714D33 - http://pgp.mit.edu/
> Finger Print:   9F67 391B B770 8FF6 99DC  D92D 87F6 2602 1371 4D33
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com
> 
> This email sent to jh...@gbis.com


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to