uiview转换成uiimage

    UIGraphicsBeginImageContext(currentView.bounds.size);

    [currentView.layer renderInContext:UIGraphicsGetCurrentContext()];

    UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();



解决模糊问题


    CGSize size = CGSizeMake(SCREEN_WIDTH, 490);
    UIGraphicsBeginImageContextWithOptions(size, NO, [UIScreen mainScreen].scale);
    [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();



猜你喜欢

转载自blog.csdn.net/chenjin360/article/details/54598831