2011-11-05 57 views
0

我修复了我的应用程序的方向为横向只。Facebook图形API - 错误的图像方向

这是我如何获得截图。

UIImage *img = UIGraphicsGetImageFromCurrentImageContext(); 

,我通过

UIImage * landscapeImage = [[UIImage alloc] initWithCGImage: img.CGImage scale: 1.0 orientation: UIImageOrientationRight]; 

我用FB iOS版SDK发布的截图给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]; 

的问题是我无法控制的方向和上传图像的方向总是要么

----- 
| | 
| P | 
----- 

----- 
| | 
| q | 
----- 

,但我想要的形象水平放置(景观)。

------- 
|  | 
------- 

在此先感谢!

回答

0
UIGraphicsBeginImageContext(CGSizeMake(1024, 768)); 
     [rotateImg drawInRect:CGRectMake(0, 0, 1024, 768)]; 
     UIImage *landscapeImage = [UIGraphicsGetImageFromCurrentImageContext() retain]; 
     UIGraphicsEndImageContext(); 

这里是如何解决这个问题。

UIimages的方向仅适用于“DISPLAY”,您需要重新绘制图像