Invalid context 0x0 on UITextField (Xcode 5)

廉价感情. 提交于 2019-12-05 09:38:36

I believe you've found an iOS bug (or at least a simulator bug). You can reproduce it even more simply:

  • New Project (Single View)
  • Drag UITextField onto Storyboard
  • Run
  • Click on UITextField.
  • Click off of UITextField
  • Click on UITextField
  • (In some cases, you need to click off of UITextField again)
  • Observe errors

I recommend opening a radar.

It seems like you are drawing some context on the screen . You need to write the code for drawing in the drawRect method . You mite have written the code elseWhere. Within the drawRect method make sure you check if the context exist as well .

CGContextRef context = UIGraphicsGetCurrentContext();
   if (context) {
        // Do your stuff
           }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!