0

I am trying to add minus button to UIKeyboardTypeNumPad using accessory view. My problem is that I want it to be over the keyboard ( on left to "0" key).

- (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;
}

I can do it using keyboard hack, but i'm afraid apple might reject my app.

PeeHaa
  • 66,697
  • 53
  • 182
  • 254
MIWMIB
  • 1,235
  • 1
  • 12
  • 24

1 Answers1

0

This type of keyboard hack might get your app rejected by Apple. If you need an extra key, it's better to design the whole keyboard instead of adding a button on the system keyboard. That would be lot easier to implement an would look neat.

For example if you want the user to enter numeric values and some of the special characters like + or -, you can design a new keyboard with only numerals and these special characters.

Source: Numerous apps on appstore(including mine).

Vin
  • 10,257
  • 10
  • 59
  • 70