Combining images

≯℡__Kan透↙ 提交于 2019-12-08 04:07:07

问题


I want to place the picked image on top of another image, so that my picked image will be placed in some sort of frame I made in Photoshop. After combining the images I want to save it to the disk.

Does anyone know how to do it, or maybe have a link to examples?


回答1:


You can just layer the two images on top of each other, first add the frame image, then add the image with the photo...

Heres sample code

Assuming your 2 images are already sized correctly to fit one on top of t he other, this code would be in a view controller

UIImageView *frame=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Frame.png"]];
UIImageView *pic=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"pic.png"]];
frame.center=[self.view center];
pic.center=[self.view center];
[self.view addSubview:frame];
[self.view addSubview:pic];

here it is, memory managment has not been written in..




回答2:


You can also add the picture UIImageView directly the the frame UIImageView: same as Daniel's suggestion above, but [frame.view addSubview: pic] instead.



来源:https://stackoverflow.com/questions/1212455/combining-images

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!