Placeholder resolving issues that placeholder and text text in Uitextfield display simultaneously

Source: Internet
Author: User

TextField uses the placeholder property, but it also sets the Text property in the code, so Viewcontroller displays both placeholder and text text.
This problem has made me completely collapsed. According to the truth, when the text length is 0 o'clock placeholder text display, text text length is not 0 o'clock placeholder should be hidden?
And I've never had this problem under normal circumstances. Later, I created a new project, and I couldn't reproduce the problem with many attempts.
Although the cause of the problem has not been found yet. But Google's work is not a bit. A question has been raised on StackOverflow, and may be associated with this article:

"Before the IOS 6 SDK (for example, the 5.1 SDK), changing the Text property of the text field, whether in code or not, would result in uitextfieldtextdidchangenotification
Notification is generated. In the iOS 6 SDK, if you change the value of text in code, the UITEXTFIELDTEXTDIDCHANGENOTIFICATION notification will not be generated. ”

I was inspired by this. That being the case, then whenever I modify the Text property (encoding mode), manually post a uitextfieldtextdidchangenotification
What about the notice? For example:

Tfphone.text = "1255"
Nsnotificationcenter.defaultcenter (). Postnotificationname (Uitextfieldtextdidchangenotification, object: Self.tfphone)

Transmission Door

http://blog.csdn.net/kmyhy/article/details/49585695

Placeholder resolving issues that placeholder and text text in Uitextfield display simultaneously

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.