drawTextInRect on UITextField not called

前端 未结 5 2005
不知归路
不知归路 2020-12-06 06:56

I\'m trying to implement the answer to this SO question. The problem is: -[drawTextInRect] is apparently not called, and setting the shadow in -[drawRect]

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-06 07:38

    This is a bug in the UITextField API documentation. The documentation indicates that overriding drawTextInRect: can be used to customize behaviour. This is not the case.

    In fact, drawTextInRect: will never be called on an UITextField (drawPlaceholderInRect: will be called neither by the way).

    See also http://discussions.apple.com/thread.jspa?threadID=1727596.

    Overriding the method on UILabel works though.

提交回复
热议问题