Add minus as accesoryView, you need your textField as a property, in this example this property: myTextField;
You need to add, after creating myTextField this code, be in viewDidLoad:
UIView *inputAccesoryView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 40)];
And add the methods of this button to your viewController:
-(void)changeNumberSing { if ([self.myTextField.text hasPrefix:@"-"]) { self.myTextField.text = [self.myTextField.text substringFromIndex:1]; }else { self.myTextField.text = [NSString stringWithFormat:@"-%@",self.myTextField.text]; } }
Onik iv
source share