views:

19

answers:

0

I am having some issues understanding and using anchorPoint. As I understand it, the default anchor is (.5,.5) which applies transforms about the center of objects. However, when I placed a UIButton into a CCUIViewWrapper, I noticed that scaling it would scale about the right side of the object (i.e. if I scaled from 0 to 1, it would grow from right to left).

I wasn't sure what to make of this, but with tinkering found that I had to adjust the anchor point to (0,0) in order to make scaling occur about the center of the object. Why would this happen?

Further more, while I expect that to make the anchor be the bottom left of the object because Cocos2d is bottom left oriented for (0,0), it did not and in fact aligned the top left with my wrapper's position value.

In the end, what worked to scale about the center was to make the anchor point (0,0) and position the wrapper using the top left of the object, almost as if it were using the UIView coordinates to place the object. I'm not certain if this behavior is something occurring strictly with wrapped UIViews in CCUIViewWrappers nor do I know if this is simply correct behavior and I'm completely misunderstanding it.

Can someone clarify and explain?