读书人

判断touch在一个View下

发布时间: 2012-08-10 12:19:33 作者: rapoo

判断touch在一个View上

UIView *temomoveView = [[UIView alloc] initWithFrame:CGRectMake(0, 200, 320, 280)];    self.moveView = temomoveView;    [temomoveView release];    [moveView setBackgroundColor:[UIColor whiteColor]];        [moveLable setBackgroundColor:[UIColor yellowColor]];    [moveLable setTextAlignment:UITextAlignmentCenter];    [moveLable setText:@"lable Text"];    [moveView addSubview:moveLable];    [self.view addSubview:moveView];        //设了一个事件监听    UITapGestureRecognizer *tapgr = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)];    [moveView addGestureRecognizer:tapgr];    [tapgr release];


然后实现tap: 方法就行了

读书人网 >移动开发

热点推荐