我imageview
在其中添加UIButton
了显示按钮,当我单击按钮时它不会调用按钮的操作。这是我正在使用的代码,我也设置了,imageView.userInteraction=enabled
但它仍然没有调用操作。
UIImageView*myImageView=[[UIImageView alloc] initWithFrame:CGRectMake(75,10,200,150)];
myImageView.image=thumbnail;
myImageView.userInteractionEnabled=YES;
[scrollView addSubview:myImageView];
UIButton*playButton=[[UIButton alloc] initWithFrame:CGRectMake(20,20,128,128)];
//[playButton setImage:[UIImage imageNamed:@"playIconPlay.png"] forState:UIControlStateNormal];
[playButton.buttonType:UIButtonTypeRoundedRect];
scrollView.userInteractionEnabled=YES;
myImageView.userInteractionEnabled=YES;
[playButton setTitle:@"Play Click" forState:UIControlStateNormal];
[playButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[playButton addTarget:self action:@selector(playButtonAction) forControlEvents:UIControlEventTouchUpInside];
myImageView.userInteractionEnabled=YES;
[myImageView addSubview:playButton];