0

My code like follow

self.view1.layer.anchorPoint = CGPointMake(1.0, 0.5);
CGAffineTransform transform = CGAffineTransformRotate(self.view1.transform,M_PI/2);
self.view1.transform = transform;

My UI is like follow

enter image description here

The light green background view is view1,it has a subview a label.If i run the code, in my opinion the view and the label will rotated M_PI/2 around the progressview's left point.But the truth is like follow:

enter image description here

Dracuuula
  • 313
  • 2
  • 15
  • I cann't see light green background view? – Mani Feb 17 '14 at 08:19
  • I think your view 1 might not be what you think. Is it defined in a storyboard? Are you sure you have view1 linked to the view, or is it just linked to the label? – HalR Feb 17 '14 at 08:21
  • @iMani sorry the cyan background color view is view1 – Dracuuula Feb 17 '14 at 08:42
  • @HalR sorry the cyan background color view is view1 – Dracuuula Feb 17 '14 at 08:43
  • Check if you have any autolayout constraint. I have seen that the behavior is different and unpredictable with some constraints. To be sure, debug disabling autolayout and removing all the autosizing masks – LombaX Feb 17 '14 at 08:55
  • @LombaX yes, you are right. How can i do it with autolayout? – Dracuuula Feb 17 '14 at 09:38
  • 1
    Check this post ;-) http://stackoverflow.com/questions/12943107/how-do-i-adjust-the-anchor-point-of-a-calayer-when-auto-layout-is-being-used/14105757#14105757 – LombaX Feb 17 '14 at 10:31

1 Answers1

0

Add

NSLog(@"%@", self.view1);

To check that self.view1 - is a background view, not the label. Also I think you need to change anchorPoint.

Avt
  • 16,927
  • 4
  • 52
  • 72