2012-02-22 69 views

回答

5

方法1:

你可以把UIButton在您UIImageView位於。將UIButton設置爲自定義類型,並在touchupinside中設置IBAction

方法2:

你可以做的是設置在UIButton背景圖像,使其類型的自定義的和touchupinside設置IBAction。這樣你就不必將UIImageView放入筆尖。請看看屏幕。

enter image description here

2

您可以正確地將視圖的userinteraction設置爲true。 然後使用以下觸摸事件來查找觸摸並推入下一個視圖。

-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event 
{ 
    UITouch *touch= [touches anyObject]; 
    if ([touch view] == your_ImageViewName) 
    { 
      write your code here to push the view.. 
    } 
} 
4
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ 
UITouch *touch = [[event allTouches] anyObject]; 
if ([touch view] == image) { 

    // image touches 
    // write code here for go to another view 
} 
else if ([touch view] == image1) { 

    // image1 touches 
    // write code here for go to another view 
} 
} 
相關問題