【发布时间】:2014-03-28 11:18:55
【问题描述】:
我正在添加以下代码以在 UITextField 右侧添加一个下拉按钮
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;
按钮在右侧可见,但是当我点击按钮时,showPicker 方法不会被调用
我在 iOS 6 中运行代码
【问题讨论】:
-
你能分享你的整个代码吗?我刚刚粘贴了你的代码,它对我有用。
标签: ios ios6 uibutton uitextfield