0

我正在尝试使用附件视图向 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;
}

我可以使用键盘黑客来做到这一点,但我担心苹果可能会拒绝我的应用程序。

4

1 回答 1

0

这种类型的键盘黑客可能会让您的应用程序被 Apple 拒绝。如果您需要额外的按键,最好设计整个键盘,而不是在系统键盘上添加一个按钮。这将更容易实现并且看起来很整洁。

例如,如果您希望用户输入数值和一些特殊字符(如 + 或 -),您可以设计一个只有数字和这些特殊字符的新键盘。

资料来源:appstore 上的众多应用程序(包括我的)。

于 2012-05-11T01:16:22.407 回答