0
我有11個UIView,每個都設置了一個手勢識別器。這個UIView在可變數組中,每個都有一個標籤。如何將UIView的標籤傳遞給方法選擇器?如何將UIView的標籤傳遞給方法選擇器?
viewIcone.userInteractionEnabled = YES;
viewIcone.tag = index;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(touchUp:)];
tap.delegate = self;
[viewIcone addGestureRecognizer:tap];
[self.arrayMutabile insertObject:viewIcone atIndex:index];
[self addSubview:viewIcone];
方法選擇器的實現是:
-(void) touchUp: (UITapGestureRecognizer *) gestureRecognizer{
NSInteger tag = [self.arrayMutabile indexOfObject:self.viewIcone];
NSLog(@"the tag is %d", tag);
}
我總是留下10錯誤在哪裏? 在此先感謝
這個幫助嗎?如果是這樣,你應該接受答案,如果沒有,我可以擴展它。 – Diziet 2012-04-12 08:27:22