ios屏幕截图

2016-07-25  本文已影响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];

}
上一篇 下一篇

猜你喜欢

热点阅读