Rounded Corners on UIImage

前端 未结 12 1081
终归单人心
终归单人心 2020-12-02 04:08

I\'m trying to draw images on the iPhone using with rounded corners, a la the contact images in the Contacts app. I\'ve got code that generally work, but it occasionally cra

12条回答
  •  广开言路
    2020-12-02 04:33

    I actually had a chance to talk about this with somebody from Apple at the iPhone Tech Talk in New York. When we talked about it, he was pretty sure it wasn't a threading issued. Instead, he thought that I needed to retain the graphics context that was generated when calling UIGraphicsBeginImageContext. This seems to violate the general rules dealing with retain rules and naming schemes, but this fellow was pretty sure he'd seen the issue previously.

    If the memory was getting scribbled, perhaps by another thread, that would certainly explain why I was only seeing the issue occasionally.

    I haven't had time to revisit the code and test out the fix, but PCheese's comment made me realize I hadn't posted the info here.

    ...unless I wrote that down wrong and UIGraphicsBeginImageContext should've been CGBitmapContextCreate...

提交回复
热议问题