Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 目标c键盘类型未更改_Ios_Objective C_Iphone - Fatal编程技术网

Ios 目标c键盘类型未更改

Ios 目标c键盘类型未更改,ios,objective-c,iphone,Ios,Objective C,Iphone,我正在尝试更改我正在使用的[ReceiveCode setKeyboardType:UIKeyboardTypeNumberPad]的输入字段键盘类型此 - (void)keyboardWasShown:(NSNotification*)aNotification { [redeemCode isFirstResponder]; [redeemCode setKeyboardType:UIKeyboardTypeNumberPad]; } 当我

我正在尝试更改我正在使用的
[ReceiveCode setKeyboardType:UIKeyboardTypeNumberPad]的输入字段键盘类型

- (void)keyboardWasShown:(NSNotification*)aNotification

    {
        [redeemCode isFirstResponder];
        [redeemCode setKeyboardType:UIKeyboardTypeNumberPad];
    }
当我当时无法更改键盘类型时,我使用了
redempticode.keyboardType=UIkeyboardtypenumbers和标点符号但是我失败了

  - (void)keyboardWasShown:(NSNotification*)aNotification
    {
        [redeemCode becomeFirstResponder];
        redeemCode.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
    }

提前感谢

移动下一行

   redeemCode.keyboardType = UIKeyboardTypeNumberPad;
到您的
视图加载
并删除其他两种方法


另外,请检查ReceiveCode是否不是
nil
,如果它是您设置的插座,则可能是
self。ReceiveCode

问题是您在键盘显示后设置了类型。 在代码前面的某个地方定义适当的键盘类型。 比如:


我做到了。ReceiveCode.keyboardType=UIKeyboardTypeNumberPad;在这种情况下,请确保此属性没有在代码中的其他地方重新定义。或者尝试在UIKeyboardWillShowNotification观察者的处理程序中设置它
UITextField *tf = //textfield allocation
tf.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
......
[tf becomeFirstResponder];