我对iphone开发和制作一个从现有相册中选择图像的应用程序是新手。选择图像后,我想把另一个视图,或另一个图标(粉刺)。
谁能告诉我如何通过代码将另一个图像放到现有图像上?
发布于 2011-08-01 22:36:21
基本上,如果你想叠加两个视图/图像,你可以像这样做:
[self.view addSubview:imageview1];
[self.view addSubview:imageview2];imageview2依赖于imageview1,因为您后来添加了它。
发布于 2011-08-01 22:43:20
您想在图像上放置UIImageView或UIView吗?首先,您需要使用所选图像的框架创建ImageView,并使用与创建第一个ImageView相同的方法创建另一个ImageView,然后将第二个ImageView添加到先前的ImageView中。如果您的第二个ImageView大小等于第一个ImageView的大小,您将无法看到您的第一个ImageView,因为它会重叠。
发布于 2011-08-01 23:17:51
如果你想在你的图片上添加一个水印,试试下面的代码:
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();https://stackoverflow.com/questions/6899944
复制相似问题