drawTextInRect on UITextField not called

前端 未结 5 2015
不知归路
不知归路 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条回答
  •  旧时难觅i
    2020-12-06 07:27

    If you don't call super, the compiler might be removing the method during optimization of your code. Effectively meaning that UILabel's implementation is getting called.


    Update: If you are using a nib to create the textfield, be sure you have set the class of the textfield in the nib to your custom subclass, otherwise your custom code will not be called.

提交回复
热议问题