图片剪切

来源:互联网 发布:非诚勿扰遗憾退场软件 编辑:程序博客网 时间:2024/04/29 17:26
CGImageRef refImage1 = CGImageCreateWithImageInRect(image.CGImage, CGRectMake(0, image.size.height *0.5, image.size.width, image.size.height *0.5));
    UIImage *image2 = [UIImage imageWithCGImage:refImage1];

    _myImage1.image = image2;



动画效果 :



if (_ishide == NO) {
        _ishide = YES;
    [UIView animateWithDuration:1 animations:^{
        _myImage.frame = CGRectMake(0, -HEIGHT *0.5, WIDTH, HEIGHT *0.5);
        _myImage1.frame = CGRectMake(0, HEIGHT, WIDTH, HEIGHT *0.5);
        
    }];
    }else
    {
        _ishide = NO;
    [UIView animateWithDuration:1 animations:^{
        _myImage.frame = CGRectMake(0, 0, WIDTH, HEIGHT *0.5);
        _myImage1.frame = CGRectMake(0, HEIGHT *0.5, WIDTH, HEIGHT *0.5);
            
    }];
    }


0 0