2011-05-08 68 views
1

我想合併單個圖像中的多個圖像,通過使用按鈕單擊>我的問題是,如果用戶在tableview中觸摸圖像,相應的圖像必須與下一頁中的主圖像合併..我們可以做到這一點嗎? enter image description hereiphone圖像合併

這是該頁面的主要圖像! this the the uppercloth

我有固定上布在漫畫

回答

1

使用UIGraphicsBeginImageContext,然後調用圖像的drawAtPoint方法,然後用UIGraphicsGetImageFromCurrentImageContext得到合併圖像。這樣的事情(沒有檢查,只是從內存中寫道..語法錯誤可能..自己糾正..)

UIGraphicsBeginImageContext(yourFirstImage.size); 
[yourFirstImage drawAtPoint:CGPointMake(0,0)]; 
[yourSecondImage drawAtPoint:CGPointMake(0,0)]; 

UIImage *mergedImage = UIGraphicsGetImageFromCurrentImageContext(); 
UIGraphicsEndImageContext(); 
+0

whrere我把這段代碼放進去了嗎? – 2011-05-08 12:25:22

+0

在你的視圖的drawRect .. – Krishnabhadra 2011-05-09 04:08:00

+0

,thnku,另一個疑問,我想在這個視圖的子視圖中創建按鈕,如果我點擊子視圖中的按鈕視圖的圖像變化是可能的? – 2011-05-09 04:26:03