开发者

Iphone sdk, Rounded UIImageView FRAME corners, not just masking it

开发者 https://www.devze.com 2022-12-25 15:21 出处:网络
i am building a app in which if a UIImageView hits another something happens, i am using the CGRectIntersetsRect statement, i would like to make it as accurate as i can, at the moment i have about 8 U

i am building a app in which if a UIImageView hits another something happens, i am using the CGRectIntersetsRect statement, i would like to make it as accurate as i can, at the moment i have about 8 UIImageViews inside this one UIImageView and i am detecting if something hits them 8 little views, i have decided that this is not a very accurate way to go about it. The problem is that the UIImageView the other UIImageView's are i开发者_运维技巧n, Its a Oval, so it is complicated, i have tryed masking it, using the image.layer.radius 10.0 or whatever the code is. but this doesnt actually transform the whole frame, is there any way to actually transform the whole frame so when a UIImageView hits the Oval shape then something happens?

if so could someone explain it to me.

Thanks Harry


this is really simple indeed. As a View, UIImageView has a layer and a layer has cornerRadius properties:

imageView.layer.cornerRadius = 5.0;
imageView.layer.masksToBounds = YES;

eBuildy, iPhone specialists


A UIImageView's frame is a CGRect, a CGRect is a rectangle and a rectangle has no rounded properties.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号