我正在尝试使用附件视图向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;
}
我可以使用键盘黑客来做,但我担心苹果可能拒绝我的应用程序。
答案 0 :(得分:0)
此类键盘黑客攻击可能会让Apple拒绝您的应用。如果您需要一个额外的键,最好设计整个键盘而不是在系统键盘上添加一个按钮。实现一个看起来很整洁的东西要容易得多。
例如,如果您希望用户输入数字值和某些特殊字符(如+或 - ),则可以设计一个仅包含数字和这些特殊字符的新键盘。
来源:appstore上的众多应用程序(包括我的)。