I'm trying to add a comma button on a number keypad that has previous, next and done buttons, so that it looks like this :
Problem is, that the orange button does not respond to taps. Actually if I moved it above the "7" button and tapped it, the 7 would be tapped. So my orange button may be shown above the keyboard, but it's reacting to taps as if it were below.
Here is an abstract of my code :
-(void)textFieldDidBeginEditing:(UITextField *)textField{
UIView *inputAccessoryView = [[UIView alloc] initWithFrame:CGRectMake(0, 500, screenWidth, 40.0)];
// 3 buttons on top
UIView *topToolbar = [[UIView alloc] initWithFrame:CGRectMake(0, 0.0, screenWidth, 40.0)];
[topToolbar addSubview:self.inputPrevButton];
[topToolbar addSubview:self.inputNextButton];
[topToolbar addSubview:self.inputDoneButton];
[inputAccessoryView addSubview:topToolbar];
// Comma button
UIButton *commaButton = [UIButton buttonWithType:UIButtonTypeCustom];
[commaButton setFrame: CGRectMake(0, 204, 105, 52)];
[commaButton setTitle:@"." forState:UIControlStateNormal];
[commaButton addTarget:self action:@selector(addComma) forControlEvents:UIControlEventTouchUpInside];
[commaButton setBackgroundColor:[UIColor orangeColor]];
[inputAccessoryView addSubview:commaButton];
// Useless, but tried anyway
[inputAccessoryView bringSubviewToFront:commaButton];
[textField setInputAccessoryView:self.inputAccessoryView];
}
All I know is that I should not be doing this (which is actually not working), so what should I do ?