使用uidatepicker编辑ios UITextField

我有一个uitextfield写的日期..如何在页面底部显示一个uidatepicker而不是标准键盘
提前致谢

解决方法

确保您的类实现了 UITextFieldDelegate协议.然后,覆盖shouldBeginEditing委托方法以返回FALSE:
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
    //check if it is the UITextField you don't want the keyboard for
    if (textField != dateTextField)
        return TRUE;

    //present your UIDatePicker
    //see instructions below

    //Return false to prevent the keyboard from appearing.
    return FALSE;
}

我建议使用另一个包含UIDatePicker的UIViewController并使用presentModalViewController来显示它.这符合用户界面指南.

相关文章

当我们远离最新的 iOS 16 更新版本时,我们听到了困扰 Apple...
欧版/美版 特别说一下,美版选错了 可能会永久丧失4G,不过只...
一般在接外包的时候, 通常第三方需要安装你的app进行测...
前言为了让更多的人永远记住12月13日,各大厂都在这一天将应...