アクセサリビューを使用して、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;
}
キーボードハックを使用してそれを行うことはできますが、アップルが私のアプリを拒否する可能性があります。