// 添加按钮
UIButton *but2 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
but2.frame = CGRectMake(200, 10, 65, 40);
[but2 setTitle:@"开始" forState:UIControlStateNormal];
but2.titleLabel.textColor= [UIColor greenColor];
[self.view addSubview:but2];
[but2 addTarget:self action:@selector(text2) forControlEvents:UIControlEventTouchDown];
// 添加图片
UIImage *img = [UIImage imageNamed:@"0000.png"];
imgeaview = [[UIImageView alloc]initWithImage:img];
imgeaview.frame = CGRectMake(100, 100, 88,89);
[self.view addSubview:imgeaview];
imgeaview.userInteractionEnabled = YES;// 开启图片事件
UITapGestureRecognizer * tap = [[UITapGestureRecognizeralloc] initWithTarget:self action:@selector(text2)];//添加手指
[imgeaview addGestureRecognizer:tap];// 添加事件