我是新來iphone發展和製作應用程序,從現有的專輯中選擇一個圖像。選擇圖像後,我想在其上放置另一個視圖或另一個圖標(痤瘡)。overLap圖片由其他圖片
誰能告訴我如何把另一個圖像放在現有的圖像的代碼?
我是新來iphone發展和製作應用程序,從現有的專輯中選擇一個圖像。選擇圖像後,我想在其上放置另一個視圖或另一個圖標(痤瘡)。overLap圖片由其他圖片
誰能告訴我如何把另一個圖像放在現有的圖像的代碼?
基本上,如果你想覆蓋兩個視圖/圖片你可以做這樣的:
[self.view addSubview:imageview1];
[self.view addSubview:imageview2];
imageview2上imageview1規定,因爲你後來添加的。
你想把UIImageView或UIView放在圖像上? 首先,您需要使用所選圖像的框架創建ImageView,並以與創建第一個ImageView相同的方式創建另一個ImageView,並將第二個ImageView添加到先前的ImageView。如果您的第二個ImageView大小等於第一個ImageView的大小,您將無法看到您的第一個ImageView,因爲它會重疊。
如果要在圖像上添加水印,請使用以下代碼:
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();
可以通過添加多個圖像瀏覽器,但它沒有記憶效率...如果你想要一次2-3圖像...這種方法可以幫助你 – Hisenberg
你的意思是通過改變圖像中的圖像查看,還是有兩個圖像視圖,並隱藏一個和顯示另一個? –
我的意思是在其他上添加圖像。 –