我想添加子視圖到UIButton。現在工作正常。但是,只要添加子視圖,該按鈕就不再可點擊。addSubView到UIButton
我使用下面的代碼:
UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(column*100+24, row*80+10, 64, 64);
[button addSubview:asyncImage];
[button addSubview:price];
[button addTarget:self
action:@selector(buttonClicked:)
forControlEvents:UIControlEventTouchUpInside];
如果我切出的2個addsubviews按鈕再次工作。如果有人知道如何解決這個問題,那就太棒了!
THNX !!!
將盡可能在2天內回答我的問題 – Jos
我想'userInteractionEnabled'屬性的相反,我認爲將其設置爲「YES」應該實際上捕捉按鈕的子視圖上的單擊事件。 GREAT ANSWER! – Shvalb
5個小時後我找到你了!謝謝 ! – YannickSteph