UImageView添加事件

来源:互联网 发布:ifconfig mac地址 编辑:程序博客网 时间:2024/04/29 12:15

UIView*view = [[UIControl alloc] initWithFrame:CGRectMake(50,200,150,150)] ;

view.backgroundColor = [UIColor clearColor];

[(UIControl *)view addTarget:self action:@selector(xxx) forControlEvents:UIControlEventTouchUpInside];

UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"a.gif"]];

imageView.frame = CGRectMake(0, 0, view.bounds.size.width, view.bounds.size.height);

[view addSubview:imageView];

[imageView release];

[self.view addSubview:view];

[view release];

0 0