SATURDAY - Yep, I went to the office again even if it is Saturday today. What I want in reporting to the office/working in weekend is the double pay. Haha! What I did today is all about my second project. I have no finished project yet, like what I've told you before, I am cujrrently handling 3 projects at the same time, even though I have no experience in iOS before.
One of the stuffs that I learned today is how to rotate your UIImage programmatically.
Please note that this code below will not change the properties of your image, meaning, it will just rotate your image but it will not be saved.
UIImageView *iv = [[UIImageView alloc] initWithImage:image]; iv.transform = CGAffineTransformMakeRotation(M_PI_2);
I found another solution. But this one is a bit different. This code will merely modify the orientation of your image (will not be saved too), and the pixels will remain untouched. Nice, isn't it?
//assume that the image is loaded in landscape mode from disk UIImage * LandscapeImage = [UIImage imageNamed: imgname]; UIImage * PortraitImage = [[UIImage alloc] initWithCGImage: LandscapeImage.CGImage scale: 1.0 orientation: UIImageOrientationRight];
That's all folks! If you find this post helpful, please subscribe and share!