Rounded Corners on UIImage

前端 未结 12 1026
终归单人心
终归单人心 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:38

    I would reiterate fjoachim's answer: be cautious when attempting to draw while running on a separate thread, or you may get EXC_BAD_ACCESS errors.

    My workaround went something like this:

    UIImage *originalImage = [UIImage imageNamed:@"OriginalImage.png"] 
    [self performSelectorOnMainThread:@selector(displayImageWithRoundedCorners:) withObject:originalImage waitUntilDone:YES];
    

    (In my case I was resizing / scaling UIImages.)

提交回复
热议问题