Posted By

vaishnavi on 12/10/10



Versions (?)

Who likes this?

4 people have marked this snippet as a favorite


Landscape orientation for a single view controller

 / Published in: Objective C

  1. CGAffineTransform transform = CGAffineTransformMakeRotation(3.14159/2);
  2. self.view.transform = transform;

Report this snippet  


RSS Icon Subscribe to comments
Posted By: sag333ar on December 17, 2010

Hey ! Vaishnavi, do you know there is already a constant for PI value. It is preferable to use it, instead of providing a value by us. I mean use "M_PI"

See, this is your statement. CGAffineTransform transform = CGAffineTransformMakeRotation(3.14159/2);

and now the preferable one is as follows. CGAffineTransform transform = CGAffineTransformMakeRotation(M_PI/2);

M_PI is declared in math.h. You never need to #import math.h. As it is already covered by Foundation Library. See, here I have provided the answer for the similar question.

I hope you might like my suggestion.

Posted By: sag333ar on December 17, 2010

There is surely some problem with this site. I posted just once & its showing me three times.

Posted By: vaishnavi on December 23, 2010

Thanks Sagar, i get your point

You need to login to post a comment.