-1

Diclaimer

I have searched several different sources including blogs, books and stackoverflow. Most of the answers about this question is about rotating object itself. For that we can use Anchor point and it works all good. What I want to do is rotate object around imaginary circle, so the tangent is always vertical(90 degrees) to center of the circle. The best way to imagine my problem is to take a gauge with point instead of arrow.

Example:

enter image description here

So, I know two ways, to add image/view inside another view, which is exactly the same size as imaginary circle and rotate it around itself. Some kind of masked UIView or image so we have virtually only one arrow, but we have a one a lot bigger element.

What do I want here then? I want to know is there a way to deal with this using layer, is there a way to set remote point as a center of rotation for element?

I will accept abstract answers with links to documentation which will prove your argument(s).

Community
  • 1
  • 1
Miknash
  • 7,888
  • 3
  • 34
  • 46
  • Honestly speaking, I don't get the question. – Sebastian Mar 10 '15 at 15:02
  • Is it possible to rotate object around another object? Is it possible to have point of rotation outside the object? – Miknash Mar 10 '15 at 15:09
  • Yes, that is clear but, IMO there needs to be more context. Sure this is possible, but with which technology do you want to have it? Or do you want to have some formula? Also, for me, the gauge confuses me more than it helps. – Sebastian Mar 10 '15 at 15:11
  • Tag is objective-c.... – Miknash Mar 10 '15 at 15:12
  • @NickCatib, yes, it called `anchorPoint` and basically every transform happens around that center. – holex Mar 10 '15 at 15:13
  • Please read the disclaimer, I already tried with anchorPoint, and it is inside the object, not outside – Miknash Mar 10 '15 at 15:14
  • @NickCatib there is no such thing as a disclaimer here. I'd rather like to see some real code and also some more proper formatting of the question. – Sebastian Mar 10 '15 at 15:19
  • Yes there is. You have to let people know what have you tried to avoid answers like try something what I already tried. Don't know why are you mad, but the code I tried is irrelevant to the question, I am trying to find another way to do it. Also, if you don't know how to help, or don't understand, either give constructive comments and ask rather then being arogant and give - for no reason. – Miknash Mar 10 '15 at 15:22
  • @NickCatib yes, it is relevant. You say you're using anchor point, which would lead to an infinite number of search results, later on there is Objective-C, which narrows it, but still. Then I found this: [How to rotate an object around a arbitrary point?](http://stackoverflow.com/questions/6160519/how-to-rotate-an-object-around-a-arbitrary-point) which you're not referencing at all, so is it relevant or not? – Sebastian Mar 10 '15 at 15:29
  • Sigh. Thats why I said that I ALREADY tried anchor points and it does NOT do the following. Since the disclaimer. Anchor point is INSIDE the object while I am looking for point OUTSIDE the object. – Miknash Mar 10 '15 at 15:32

1 Answers1

1

Okay, found a solution. It was rotating point I found after few more hours of research. Solution is here :

One step affine transform for rotation around a point?

Another usefull link is here:

Core Animation rotation around point

Hope it helps someone out there.

Community
  • 1
  • 1
Miknash
  • 7,888
  • 3
  • 34
  • 46