1
A
回答
0
爲什麼你不只是有一個UIView,並把這兩個圖像作爲子視圖?
UIImageView *image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"myimage.png"]];
UIView *imagesView = [[UIView alloc] initWithFrame:image.frame];
[imagesView addSubview:image];
UIImageView *imageToOverlay = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"myimagetooverlay.png"]];
[imageToOverlay setCenter:CGPointMake(10,10)];
[imagesView addSubview:imageToOverlay];
[self.view addSubview:imagesView];
4
Zapacila,你找到了你的問題的答案?你可以這樣做:
#define imageWidth 40
#define imageHeight 60
UIImage *image1 = [UIImage imageNamed:@"firstimage.png"];
UIImage *image2 = [UIImage imageNamed: @"secondimage.png"];
CGSize itemSize = CGSizeMake(imageWidth, imageHeight);
UIGraphicsBeginImageContext(itemSize);
CGRect imageRect = CGRectMake(0.0, 0.0, itemSize.width, itemSize.height);
[image1 drawInRect:imageRect];
[image2 drawInRect:imageRect];
UIImage *overlappedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImage overlappedImage是一個新的圖像,其中包含最初的,重疊的。說實話,我不知道這是否是達到這個結果的最好方法,但我知道它確實有效。
如果在此期間您找到了更有效的解決方案,請告訴我!
相關問題
- 1. 如何將一張圖片重疊在另一張圖片上?
- 2. CSS - 將另一張圖片重疊在另一張圖片上
- 3. 基於重疊將多張圖像合併爲一張單張圖片
- 4. 將2張圖片放在同一行
- 5. PHP下一張/上一張圖片Loop
- 6. 連續設置4張圖片而不是2張圖片
- 7. 如何將兩張圖像合併爲一張圖像,並將兩張圖像合併爲一張圖像,然後再將第二張圖像合成一張?
- 8. CSS 2張圖片全寬一列
- 9. 每2秒更換一張圖片
- 10. 生成x張圖片
- 11. 將幾張圖片合併成一個大圖片
- 12. 響應圖像電網 - 3張圖片,1左2右疊
- 13. JQuery noob - 將鼠標懸停在一張圖片上,更換另一張圖片
- 14. 如何將9張sns.displot()圖片合併爲1張圖片?
- 15. 第一張圖片保存在第二張圖片上傳中?
- 16. 如何用iphone sdk比較兩張圖片?
- 17. iPhone SDK:多張圖片上傳到服務器的SOAP請求
- 18. 將圖片放在第二張圖片
- 19. 如何將1到5張圖片放在另一張圖片上?
- 20. 將250張圖片捕捉到每個單元格一張圖片
- 21. 如何保存2張圖片(swift3)
- 22. 使用C#比較2張圖片
- 23. 比較php中的2張圖片
- 24. 交換2張圖片 - javascript/jquery
- 25. 以HTML格式上傳2張圖片
- 26. 懸停在Jquery的2張圖片上
- 27. 2張圖片之間的標題1
- 28. 在opencv中拼接2張圖片
- 29. 帶2張圖片的HTML背景
- 30. Firebase多張圖片
謝謝。 但是,這實際上是一個圖像的畫廊,將像20圖像..所以20 uiviews不能解決它。另外,我有點需要之後的縮略圖 – Zapacila 2010-09-03 21:33:42