Combining images

2019-06-01 04:33发布

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?

2条回答
Ridiculous、
2楼-- · 2019-06-01 04:47

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..

查看更多
地球回转人心会变
3楼-- · 2019-06-01 04:52

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

查看更多
登录 后发表回答