/ Published in: Objective C

Expand |
Embed | Plain Text

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

## Comments

Subscribe to commentsYou need to login to post a comment.

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. http://stackoverflow.com/questions/3263576

I hope you might like my suggestion.

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

Thanks Sagar, i get your point