使用UIButton,您可以看到用戶單擊了該按鈕(圖像變爲灰色)。(iphone)如何顯示imageview被點擊爲uibutton?
我想在UIImageView中的行爲,並想知道如何做到這一點。
另一種可能的方法是使用UIButton,讓它在視覺上反應(變成灰色)
但假裝touch沒有發生(因爲我需要將touch事件傳遞給superview或nextresponder)。
謝謝。
- 編輯
其實我結束了繼承的UIButton和 實施的touchesBegan /移動/結束了highlightning
- (void) touchesBegan: (NSSet *) touches withEvent: (UIEvent *) event
{
[super touchesBegan: touches withEvent: event];
[self.nextResponder touchesBegan: touches withEvent: event];
}
第一的touchesBegan,
第二個用於妥善處理我所需要的。
不知道叫兩個touchesBegan會好..
啊,我看到的是,如果我不肯定將是巨大的必須爲高亮顯示的狀態提供另一個圖像。 – eugene 2011-03-15 10:42:12
如果我必須走這條路線,我應該如何創建突出顯示的圖像? (如在選擇的按鈕中出現)改變alpha? – eugene 2011-03-15 11:34:53
一般來說,我會添加一個CATransition動畫效果來產生淡出動畫。 – AechoLiu 2011-03-16 03:44:54