美文网首页
ios屏幕截图

ios屏幕截图

作者: 起个啥名字呢 | 来源:发表于2016-07-25 15:55 被阅读36次
-(UIImage *)screenShots:(UIView *)orgView {
    //获取指定View的图片

    UIGraphicsBeginImageContextWithOptions(orgView.bounds.size, NO, 0.0);
    CGContextRef context = UIGraphicsGetCurrentContext();
    [orgView.layer renderInContext:context];
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return image;
}
- (void)navRightAction:(UIButton *)button{
    
        UIWindow *window = [UIApplication sharedApplication].keyWindow;
        UIImage * img= [self  screenShots:window];
        ELE_MessageDetail * detail = [[ELE_MessageDetail alloc] init];
                                    
                                    
        detail.image = img;
        detail.msgContentType = [NSString stringWithFormat:@"%d",ELEDETAILIMAGE];
        [self shareTheChannelArticleData:detail];

}

相关文章

网友评论

      本文标题:ios屏幕截图

      本文链接:https://www.haomeiwen.com/subject/hlngjttx.html