2012-02-22 35 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 
} 
} 
相关问题