【问题标题】:Placeholder for textfield problem in ios 4.2ios 4.2中文本字段问题的占位符
【发布时间】:2011-05-31 00:45:46
【问题描述】:

我在表格自定义单元格中有一个 UITextField。我已将 TextField 文本对齐设置为 UITextAlignmentCenter。我还向此 textField 添加了占位符文本并将此 textField 设为 firstResponder 。现在,在 ios 3.0 和 4.0 中发生了什么,它可以工作完美(光标在中心闪烁,输入的文本也在中心) 但在 ios 4.2.1 中,光标在左侧闪烁,而输入的文本始终居中对齐。如果我删除占位符文本,即使在 ios 4.2.1 中一切正常。

【问题讨论】:

    标签: iphone objective-c ios uitextfield


    【解决方案1】:

    我对这个问题的看法:

       If you notice the cursor position in prior versions(iOS 4.0 and 4.1),   
    you can notice that the cursor is not placed exactly at the center of the
    placeholder text. But in 4.2 the cursor is placed neatly at the left side of 
    the placeholder. 
    

    请看以下屏幕截图。

    以前版本(iOS 4.0 和 4.1)中的光标位置:

    iOS 4.2 中的光标位置:

    如果我们注意到光标位置在 4.2 中得到了改进,它看起来比旧版本更好。

    I guess Apple has made this intentionally to make it better.
    

    【讨论】:

    • 很好,但是如果应用程序在应用商店中,用户可能会报告应用程序中的错误,因为即使在 ios 4.2 中光标也应该在中心
    • 是的。起初用户可能希望光标在 iOS 4.2 中也位于中心。但如果他们习惯了,他们会觉得这种变化更好。
    • 你是完全正确的。但我的要求是即使在 4.2 中也需要居中对齐。如果我删除占位符文本,我可以让居中对齐光标闪烁。但我希望光标在中心和占位符文本中闪烁以及。请在那个方向上帮助我
    • 对不起,伙计..我认为我在这方面没有足够的知识来帮助你..当然,如果我找到解决方案,我会发布给你..同时其他人可能会帮助你..干杯男人!!
    猜你喜欢
    • 2016-11-28
    • 1970-01-01
    • 1970-01-01
    • 2013-09-25
    • 2012-10-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多