I fix my app's orientation to be landscape only.
This is how I get the screenshot.
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
and I change the orientation through
UIImage * landscapeImage = [[UIImage alloc] initWithCGImage: img.CGImage scale: 1.0 orientation: UIImageOrientationRight];
I use fb iOS SDK to post the screenshot to facebook.
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
landscapeImage, @"picture",
SOME_URL,@"link",
@"Have fun",@"name",
@"Join the fun",@"message",
@"0",@"position",
nil];
[_facebook requestWithGraphPath:@"me/photos"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];
The problem is that I cannot control the orientation and the orientation of the uploaded images are always either
-----
| |
| P |
-----
or
-----
| |
| q |
-----
but i want the image to laid horizontally(landscape).
-------
| |
-------
thanks in advance!
UIGraphicsBeginImageContext(CGSizeMake(1024, 768));
[rotateImg drawInRect:CGRectMake(0, 0, 1024, 768)];
UIImage *landscapeImage = [UIGraphicsGetImageFromCurrentImageContext() retain];
UIGraphicsEndImageContext();
here is how to resolve the problem.
UIimages's orientation is for "DISPLAY" only, you need to redraw the image