Rounded Corners on UIImage

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

    Set the Image in xib or storyboard (image width and height 41x41).

    FirstViewController.h

    @interface....
    
    IBOutlet UIImageView *testImg;
    
    @end
    

    FirstViewController.m

    -(void)viewDidLoad{
            testImg.layer.backgroundColor=[[UIColor clearColor] CGColor];
            testImg.layer.cornerRadius=20;
            testImg.layer.masksToBounds = YES;
        }
    

提交回复
热议问题