0
我有一個inputAccessoryView
其中包括UIButton
,但UIButton
沒有響應水龍頭(甚至沒有改變它的形象)。我不知道爲什麼。這是我非常簡單的代碼:UIButton添加到inputAccessoryView沒有檢測到觸摸
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;