0

中的代碼調用tapGesture IBAction我有一個視圖,我在這個視圖中添加了一個句柄函數tapGesture, ,我想調用代碼中的tap操作來調用句柄函數。 ..如何從obiective-c

- (IBAction爲)handleTapGesture:(UIGestureRecognizer *)發件人

我怎麼能做到這一點???

現在我可以得到這個觀點,如何從代碼中調用tap動作?

我發現它的一些功能,但它不工作。

如:UIControl sendActionsForControlEvents/UIView的performSelector ...

回答

0

什麼

[theView handleTapGesture:nil]; 

+0

handleTapGesture是在上海華控制器.. – GanLiting 2012-07-13 07:24:19

0

在您的視圖控制器,把這段代碼

UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)]; 
    tapGesture.numberOfTapsRequired=1; 
    [self.currentImageView addGestureRecognizer:tapGesture]; 
    [tapGesture release]; 

then write your code for tap function in 

-(void) handleTapGesture:(UITapGestureRecognizer *)sender { 

}