Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. -(void)setSelected:(bool)s {
  2. selected=s;
  3. if (s)
  4. {
  5. CATransform3D rot = CATransform3DMakeRotation(M_PI, 0, 1, 0);
  6. rot.m34=-1.0 / 200;
  7. [self setTransform:rot];
  8.  
  9. }
  10. else
  11. {
  12. CATransform3D rot = CATransform3DMakeRotation(0, 0, 1, 0);
  13. rot.m34=-1.0 / 200;
  14. [self setTransform:rot];
  15. }
  16. }
  17.  
  18. -(void)setSelected:(bool)s {
  19. selected=s;
  20. CATransform3D perpectiveTransform = CATransform3DIdentity;
  21. perpectiveTransform.m34 =-1.0 / 200;
  22.  
  23. if (s)
  24. {
  25.  
  26. CATransform3D rot = CATransform3DMakeRotation(M_PI, 0, 1, 0);
  27. [self setTransform:CATransform3DConcat(rot, perpectiveTransform)];
  28.  
  29. }
  30. else
  31. {
  32. CATransform3D rot = CATransform3DMakeRotation(0, 0, 1, 0);
  33. [self setTransform:CATransform3DConcat(rot, perpectiveTransform)];
  34. }
  35. }
  36.  
  37. self.superlayer.sublayerTransform = perspectiveTransform; //do this in your setup
  38. ....
  39. self.transform = rot;
  40.  
  41. yourView.layer.transform = CATransform3DMakeScale(-1, 1, 1);
  42.  
  43. yourView.layer.affineTransform = CGAffineTransformMakeScale(-1, 1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement