-2

I've got a view and I would like to scale this view as like below image. How do we achieve this?

Thanks, Maheshenter image description here

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Magesh
  • 685
  • 2
  • 7
  • 15
  • Have you considered using affine transform? – Raz May 08 '14 at 13:01
  • No.. Please advise me how to achieve this. – Magesh May 08 '14 at 13:30
  • 1
    you can play with the `layer.sublayerTransform` and can set a matrix which defines the perspective for the actual view. that would not be a real 3D environment, but it is still good enough for making nice 2.5D effects in your app. – holex May 08 '14 at 13:33

1 Answers1

0

You need to rotate your view's layer. Something like this,

CALayer *layer = yourView.layer;
CATransform3D rotationTransform = CATransform3DIdentity;
rotationTransform.m24 = 1.0 / -350;
rotationTransform = CATransform3DRotate(rotationTransform, 60*M_PI/180, 1.0, 0.0, -0.1);
[layer setTransform: rotationTransform];

Check out this guide to understand CALayer's geometry and how it works.

Seryozha
  • 1,649
  • 1
  • 14
  • 13