首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

判断touch在一个View下

2012-08-10 
判断touch在一个View上UIView *temomoveView [[UIView alloc] initWithFrame:CGRectMake(0, 200, 320, 2

判断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: 方法就行了

热点排行