逗号和十进制键盘上的点

时间:2015-06-12 11:47:35

标签: ios objective-c keyboard

我有一个十进制键盘,我想要点和逗号。默认情况下可以吗?

我试图添加一个自定义按钮,但方法addDot没有被调用。知道为什么或如何做到这一点?

 -(void)textFieldDidBeginEditing:(UITextField *)textField{
     if ([self.cowPrice isFirstResponder] ) {
         UIButton *commaButton = [UIButton buttonWithType:UIButtonTypeCustom];
         [commaButton setFrame: CGRectMake(0, 206, 53, 55)];
         [commaButton setTitle:@"," forState:UIControlStateNormal];
         [commaButton addTarget:self action:@selector(addComma) forControlEvents:UIControlEventTouchUpInside];
         [commaButton setBackgroundColor:[UIColor orangeColor]];
         [ self.cowPrice.inputAccessoryView addSubview:commaButton];
         [self.cowPrice.inputAccessoryView bringSubviewToFront:commaButton];
     }
 }

-(void)addComma{
    NSLog(@"yes");
}

enter image description here

0 个答案:

没有答案