overLap图像由另一个图像

时间:2011-08-01 14:31:39

标签: iphone objective-c cocoa-touch uiimage uiimagepickercontroller

我是iphone开发的新手,并且制作了一个从现有专辑中选择图像的应用程序。选择图像后,我想在其上放置另一个视图,或其他图标(粉刺)。

任何人都可以通过代码????

告诉我如何在现有图像上放置另一个图像

3 个答案:

答案 0 :(得分:0)

基本上,如果你想覆盖两个视图/图像,你可以这样做:

[self.view addSubview:imageview1];  
[self.view addSubview:imageview2];

imageview2位于imageview1上,因为您稍后添加了它。

答案 1 :(得分:0)

您想在图像上放置UIImageView或UIView吗? 首先,您需要使用所选图像的框架创建ImageView,并以与创建第一个ImageView相同的方式创建另一个ImageView,并将第二个ImageView添加到之前的ImageView。如果你的第二个ImageView大小等于第一个ImageView的大小,你将无法看到你的第一个ImageView,因为它会重叠..

答案 2 :(得分:0)

如果您想在图片上添加水印,请尝试以下代码:

UIGraphicsBeginImageContext(CGSizeMake(320, 480));
// This is where we resize captured image
[(UIImage *)[info objectForKey:UIImagePickerControllerOriginalImage] drawInRect:CGRectMake(0, 0, 320, 480)];
// And add the watermark on top of it
[[UIImage imageNamed:@"Watermark.png"] drawAtPoint:CGPointMake(0, 0) blendMode:kCGBlendModeNormal alpha:WATERMARK_ALPHA];
// Save the results directly to the image view property
imageView.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();