我正在尝试使用附件视图向 UIKeyboardTypeNumPad 添加减号按钮。我的问题是我希望它在键盘上(左侧到“0”键)。
- (UIView *)inputAccessoryView {
if (!inputAccessoryView) {
CGRect accessFrame = CGRectMake(0, 219, 106, 53);
inputAccessoryView = [[UIView alloc] initWithFrame:accessFrame];
inputAccessoryView.backgroundColor = [UIColor blueColor];
UIButton *compButton = [UIButton buttonWithType:UIButtonTypeCustom];
compButton.frame = CGRectMake(0, 219, 106, 53);
[compButton setTitle: @"Word" forState:UIControlStateNormal];
[compButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[compButton addTarget:self action:@selector(minusButtonTouched:)
forControlEvents:UIControlEventTouchUpInside];
[inputAccessoryView addSubview:compButton];
}
return inputAccessoryView;
}
我可以使用键盘黑客来做到这一点,但我担心苹果可能会拒绝我的应用程序。