2010-07-15 7 views

Répondre

1

Essayez ceci:

UIGraphicsBeginImageContext(map.layer.bounds.size); 
[map.layer renderInContext:UIGraphicxGetCurrentContext()]; 
UIImage *mapImage = UIGraphicsGetImageFromCurrentImageContext(); 
UIGraphicsEndImageContext(); 

Et peut-être vous devriez aussi revérifier les conditions de licence de Google si elles permettent la fabrication et la distribution des captures d'écran des cartes.

+0

Voici le code qui a finalement fonctionné pour moi: CGRect screenRect = [[UIScreen mainScreen] bounds]; \t UIGraphicsBeginImageContext (screenRect.size); \t CGContextRef ctx = UIGraphicsGetCurrentContext(); \t CGContextFillRect (ctx, screenRect); \t [self.view.layer renderInContext: ctx]; \t UIImage * viewImage = UIGraphicsGetImageFromCurrentImageContext(); \t UIGraphicsEndImageContext(); \t UIImageWriteToSavedPhotosAlbum (viewImage, self, nil, nil); – MadProfit

+0

De plus, il faut ajouter le framework Quartzcore et utiliser le Quartzcore dans le fichier d'implémentation. – MadProfit

+0

Par programme, on ne peut attacher ou intégrer qu'une seule photo ou image dans un email. Sorta a du sens, sinon on pourrait imaginer quelqu'un ayant de très gros courriels par conception de programme ou accident qui causerait de la mémoire à l'iphone ou d'autres problèmes. – MadProfit