我有一个十进制键盘,我想要点和逗号。默认情况下可以吗?
我试图添加一个自定义按钮,但方法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");
}