UIImage剪切

UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];

    imageView.center = CGPointMake(200, 300);

    imageView.backgroundColor= [ UIColor redColor];

    UIImage *anotherImage = [UIImage imageNamed:@"476F762C08F8CAC35D2624F02DF4E62F"];

    UIGraphicsBeginImageContextWithOptions(imageView.bounds.size, NO, 1.0);

    [[UIBezierPath bezierPathWithRoundedRect:imageView.bounds

                                cornerRadius:40] addClip];

    

    

    

    [anotherImage drawInRect:imageView.bounds];

    imageView.image = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    [self.view addSubview:imageView];

posted @ 2016-01-20 15:48  金刚葫芦娃哈哈  阅读(120)  评论(0编辑  收藏  举报