Return Inputs to UITextfield with custom inputView

前端 未结 2 1874
情书的邮戳
情书的邮戳 2021-01-16 17:33

i created a UITextField and a custom View. after that i added this custom view as \"inputView\" to my UITextField.

 amountKeyboardViewController *amountKeybo         


        
2条回答
  •  没有蜡笔的小新
    2021-01-16 18:00

    You mean that if you press 1 then '1' should shown in textfield.

    after that if you press 2 then it will show '12'.

    Do you want like this?

    You have to write IBaction for all buttons eg.

    -(IBAction)clickof1
    {
        if([amountTextField.text length] <= 0)
           amountTextField.text = @"1";
        else
           amountTextField.text = [amountTextField.text stringByAppendingString:@"1"];
    }
    
    -(IBAction)clickof2
    {
        if([amountTextField.text length] <= 0)
           amountTextField.text = @"2";
        else
           amountTextField.text = [amountTextField.text stringByAppendingString:@"2"];
    }
    

    like that you have to write IBaction for all your buttons

提交回复
热议问题