开发者

How do I draw a proper parallelogram that can be animated on iPhone?

开发者 https://www.devze.com 2022-12-27 07:19 出处:网络
I\'m trying to do something very simple: I need some parallelograms in my program. These are attached to other objects, all of which are UIViews. It\'s important that I be able to animate these, since

I'm trying to do something very simple: I need some parallelograms in my program. These are attached to other objects, all of which are UIViews. It's important that I be able to animate these, since the objects they are attached to can also be animated.

I've figured out how to use the transform in UIView/CALayer to do this, but the problem is that these sheared UIViews 开发者_StackOverflow中文版don't look very nice: there is no anti-aliasing of the edges.

Is there some other way to do this? I would like to use UIViews, since I also use them for user interaction and animation is so much easier than drawing by hand. I don't want to use OpenGL for this.


Draw them with UIBezierPath.


You can enable edge antialiasing by modifying your app's Info.plist.

You need to add the UIViewEdgeAntialiasing key, with Boolean YES as the value. The human-friendly name in Xcode's Info editor is “Renders with edge antialiasing”.

0

精彩评论

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

关注公众号