【问题标题】:How to dismiss number pad on return key如何关闭返回键上的数字键盘
【发布时间】:2010-03-30 17:42:47
【问题描述】:
-(BOOL) textFieldShouldReturn:(UITextField*) theTextField{
    [theTextField resignFirstResponder];
    return YES;
}

它不工作....

【问题讨论】:

    标签: iphone uitextfield


    【解决方案1】:

    This answer 表明代理决定是否关闭键盘。

    如果要关闭键盘,textFieldShouldReturn: 必须返回 NO:

    -(BOOL) textFieldShouldReturn:(UITextField*) theTextField{
        [theTextField resignFirstResponder];
        return NO;
    }
    

    【讨论】:

    • 这似乎不再适用于 iOS 7.1 的数字键盘 如果键盘类型是数字键盘,则不会调用该方法,但如果它是默认键盘类型,则会调用该方法。
    猜你喜欢
    • 2014-11-12
    • 2010-10-16
    • 1970-01-01
    • 1970-01-01
    • 2015-10-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-17
    相关资源
    最近更新 更多