Reputation: 1689
I found an app which has an arrow which is used as a compass. The arrow moves when I rotate my device. You can see it in the following screen shots:
You can see that the size of the arrow changes depending on its direction as well as the gray shadow behind the arrow.
How can I create a 3D arrow with Swift or Objective-C? How can I make an image to appear 3D?
Upvotes: 0
Views: 702
Reputation: 131503
That's more like 2.5D, as it's sometimes called. It's a 2D image that's projected in 3D space. You can do that by applying a 3D transform to an image view's layer, and then modifying the m34 entry in the transform to a small negative value that gives the perspective. A value like -1/200 is a good starting point.
I suggest you look up CATransform3D perspective on Google. When I do that search the first link looks quite promising: How do I apply a perspective transform to a UIView?
Upvotes: 2