我有一个主视图控制器,其中有两个子视图,一个是注释视图,另一个是共享视图。当我点击主视图控制器中的tableview单元格时,它会弹出笔记视图,如果用户点击按钮弹出另一个子视图共享视图,则在注释视图中有按钮。但是,当用户点击note-view时,我需要关闭共享视图。是否可以在子视图中实现触摸事件? 我已经这样做了编码,但结果是错误 在viewDidLoad中如何在子视图中设置触摸事件?
NotesView *label =[[NotesView alloc]init];
UITapGestureRecognizer *tapGesture =
[[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(NoteTap)] autorelease];
[label addGestureRecognizer:tapGesture];
[tapGesture release];
然后
-(void)NoteTap
{
UIView *langview = (UIView *)[self.view viewWithTag:120];
//ViewWithTag Number should be same as used while allocating
[langview removeFromSuperview];
}
@EmptyStack我怎样才能解决这个问题先生?谢谢 – ICoder