How to shift shape (from oval to rect and vice versa) animated?
Dirty code:
UIBezierPath *roundedRectBezierPath = [UIBezierPath bezierPathWithRounded
If you look at the documentation this is exactly the behavior that you should expect. From the docs:
If the two paths have a different number of control points or segments the results are undefined.
You can get around this in two ways: either
For the first option I would use addArcWithCenter:radius:startAngle:endAngle:clockwise:
four times to make up the rounded rect. (It will automatically add the straight lines to your path). You can read more about the construction of Bézier paths in "Thinking like Bézier paths" (written by me). There are some interactive elements there that should help you figure out how adding arcs to a path works.
The other option is to create the paths any way you want with different numbers of control points and/or segments and do the animation yourself. This is an excellent explanation of how to do your own path animations with shape layers.