0
我添加以下代碼以添加一個下拉按鈕的UITextField右側AddTarget不上的UITextField rightView
self.filterTextView.rightViewMode = UITextFieldViewModeAlways;
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
[btn setFrame:CGRectMake(0, 0, 32, 32)];
[btn setBackgroundImage:[UIImage imageNamed:@"downArrow.png"] forState:UIControlStateNormal];
[btn addTarget:self action:@selector(showPicker:) forControlEvents:UIControlEventTouchUpInside];
self.filterTextView.rightView = btn;
按鈕的工作是在右邊SIE可見,但showPicker
方法,當我敲擊不會被調用按鈕
我正在運行iOS 6中的代碼
可以ü請分享你的整個代碼。我只是粘貼你的代碼,它爲我工作。 – Bhupesh