Iphone 我可以在imageview上为drwing制作另一层吗
我想在背景图像上画图,什么时候我要擦除该图形,然后只擦除图形而不是背景图像?我如何才能完成该任务。通过此代码,我的背景图像也会被擦除Iphone 我可以在imageview上为drwing制作另一层吗,iphone,ios,Iphone,Ios,我想在背景图像上画图,什么时候我要擦除该图形,然后只擦除图形而不是背景图像?我如何才能完成该任务。通过此代码,我的背景图像也会被擦除 `将另一个UIImageView添加到您的imageDoodle: //Add outer ImgView for Drawing purpose imgView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0,imageDoodle.frame.size.width, imageDoodle.frame.s
`将
另一个UIImageView
添加到您的imageDoodle
:
//Add outer ImgView for Drawing purpose
imgView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0,imageDoodle.frame.size.width, imageDoodle.frame.size.height)];
imgView.userInteractionEnabled = YES;
imgView.multipleTouchEnabled = YES;
[imageDoodle addSubview:imgView];
编辑:现在使用相同的代码,但使用imgView
进行绘图
:
[imgView.image drawInRect:CGRectMake(0, 0, imageDoodle.frame.size.width, imageDoodle.frame.size.height)];
在imgView中设置当前图像
imgView.image = UIGraphicsGetImageFromCurrentImageContext();
现在用mainImageView
设置原始图像
现在render
mainImageView
获取backgroundimage+绘图
将透明UIView添加到ImageView中,并根据ImageView或imagesize按比例给出其高度和宽度。无论你想画什么,在uiview中画并擦除它 给我举个例子..让你在imgView中设置当前图像,比如imgView.image=UIGraphicsGetImageFromCurrentImageContext();是的,我想显示最终图像=背景图像+绘图
imgView.image = UIGraphicsGetImageFromCurrentImageContext();