【发布时间】:2013-06-14 06:51:33
【问题描述】:
-(void) SaveScreenImage{
UIGraphicsBeginImageContext(self.view.bounds.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image= UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSData* data = UIImagePNGRepresentation ( image );
UIImage* pngImage = [UIImage imageWithData:data];
UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);
UIGraphicsEndImageContext();
}
- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(NSString *)contextInfo
{
UIImage *myImageView = image;
NSLog(@"%@",contextInfo);
NSString *message;
NSString *title;
if (!error) {
title = NSLocalizedString(@"restore successful", @"");
message = NSLocalizedString(@"restore to album libaray", @"");
} else {
title = NSLocalizedString(@"restore failure", @"");
message = [error description];
}
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title
message:message
delegate:nil
cancelButtonTitle:NSLocalizedString(@"nice", @"")
otherButtonTitles:nil];
[alert show];
[alert release];
//send contents to weixin
WXMediaMessage *weixinmessage = [WXMediaMessage message];
[weixinmessage setThumbImage:myImageView];
WXImageObject *ext = [WXImageObject object];
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"png"];
ext.imageData = [NSData dataWithContentsOfFile:filePath];
//added media information
weixinmessage.mediaObject = ext;
SendMessageToWXReq* req = [[[SendMessageToWXReq alloc] init]autorelease];
req.bText = NO;
req.message = weixinmessage;
req.scene = _scene;
[WXApi sendReq:req];
}
【问题讨论】:
-
这是什么语言?怎么了?你想要什么?
-
iOS,我想从快照中获取正确的照片。
-
第一步:复制当前画面。 step 2:获取正确的照片形式相册。step 3:发送消息到微信通讯工具。
标签: ios cocoa-touch path photo