我有一个inputAccessoryView
其中包括一个UIButton
,但UIButton
没有响应水龙头(甚至没有改变它的图像)。我不确定为什么。这是我相当简单的代码:
UIImageView *accessoryView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 60)];
UIButton *selectionModeOkButton = [[UIButton alloc] initWithFrame:CGRectMake(264, 11, 50, 46)];
[selectionModeOkButton setImage:[UIImage imageNamed:@"btn_count_ok_unpressed"] forState:UIControlStateNormal];
[selectionModeOkButton setImage:[UIImage imageNamed:@"btn_count_ok_pressed"] forState:UIControlStateHighlighted];
[selectionModeOkButton addTarget:self action:@selector(selectionModeOkButtonPressed) forControlEvents:UIControlEventTouchUpInside];
[accessoryView addSubview:selectionModeOkButton];
self.selectionModeTextField.inputAccessoryView = accessoryView;