2012-11-20 5 views

답변

3

UIImageViewuserInteractionEnabled 속성이 기본적으로 NO으로 설정되어 있기 때문입니다. YES으로 설정하면 제대로 작동합니다.

+0

이 UIKit에서 다른 머리가 나쁜 불일치이다, 그건 그렇고. 그것은 의도적이지만 좋은 것보다 혼란 스럽습니다. –

0

단추에 IBAction이 연결되어 있는지 확인하십시오. 사용자 상호 작용이 활성화되어 있는지 확인하십시오.

0

이것을 시도해보십시오.

UIIMageView *image; 
image.userInteractionEnabled=YES; 

희망이 어느 한

미누

먼저 당신이 이미지 뷰가 다음 다음 버튼이 제대로이 코드와 유사하게 동작 버튼을 추가 추가
0

을하는 데 도움이

UIView *AddView=[[UIView alloc]initWithFrame:CGRectMake(55, 0, 100, 100)]; 
UIImageView *imgview=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 100, 100)]; 


       UIButton *btnRemove = [[UIButton alloc]init]; 
       UIImage *btnImage = [UIImage imageNamed:@"close.png"]; 
       [btnRemove setImage:btnImage forState:UIControlStateNormal]; 
       [btnRemove addTarget:self 
           action:@selector(btnREmoveAction:) 
        forControlEvents:UIControlEventTouchUpInside]; 
       btnRemove.frame = CGRectMake(0,0, 29, 29); 

       btnRemove.tag=indexStart; 

       [AddView addSubview:imgview]; // add the imageview 
       [AddView addSubview:btnRemove]; // add the button 
관련 문제