2011-11-05 26 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」,您需要重新繪製圖像