Phi*_*hil 0 iphone collision uiimageview ios
我有一个UIImageview包含一个圆圈(障碍物),然后另一个UIImageview包含另一个图像(我的角色).当我的圈子击中我的角色时,游戏结束.
我的问题发生在游戏结束时,角色触摸UIImageview我的圆圈所在的方框,而不是UIImageview方框内的圆圈.
我能想到的解决方案是:
UIImageview圆形适合我的圆圈.UIImageviews.真的很感激帮助和想法.我是xcode的初学者.
谢谢!
Couple of different techniques:
1)UIView#layer.cornerRadius - Super simple to implement, just set that one property. But really bad for scrolling elements like table views.
2)UIImageView as a mask - Also easy to implement. Basically make a square image with a transparent circle in the middle and slap it on top of your view with a new UIImageView. If your circle design has some reflections or styling, this might make your life easier.
3)Custom drawing - Make a UIView subclass and override drawRect to draw your image and clip it to a circular path.
Hope that helps!
EDIT:
You can read this answers.
1)Fill an UIBezierPath with a UIImage
2)iOS:反向UIBezierPath(bezierPathWithOvalInRect)
| 归档时间: |
|
| 查看次数: |
2966 次 |
| 最近记录: |