2013-11-20 58 views
3

因此,假設我想製作截圖並將其發佈到Twitter上。呈現時,SLComposeViewController閃爍。drawViewHierarchyInRect,在呈現SLComposeViewController時閃爍

UIImage *image; 

UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, NO, [UIScreen mainScreen].scale); 
[self.view drawViewHierarchyInRect:self.view.bounds afterScreenUpdates:YES]; 

image = UIGraphicsGetImageFromCurrentImageContext(); 
UIGraphicsEndImageContext(); 

SLComposeViewController *compose = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter]; 
[compose addImage:image]; 
[self presentViewController:compose animated:YES completion:nil]; 

僅當「afterScreenUpdates:YES」,「afterScreenUpdates:NO」不閃爍時纔會發生此行爲。

爲什麼閃爍?我測試的iPhone 5

+0

同樣的事情發生在我身上.. – Ben

回答

0

我知道這是一個有點老,但這裏是我工作:

集afterScreenUpdates:NO