Search code examples
iosobjective-cuibuttonuiimagecalayer

Setting layer out of layer in UIbutton?


enter image description here

i want this type of button i have tried pictureBtn which is UIbutton ,i gave it a 5 pixel clear color corner radius and add a picture like camera below but last outer white line how to deal with this can anybody have ideas or something like control.


Solution

  • This is my output code for my solution -

        UIButton *picBtn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 60, 60)];
    
        [picBtn setImage:[UIImage imageNamed:@"CM.png"] forState:UIControlStateNormal];
    
        [picBtn setBackgroundColor:[UIColor clearColor]];
    
        [picBtn setImageEdgeInsets:UIEdgeInsetsMake(10, 10, 10, 10)];
    
        [picBtn.layer setCornerRadius:picBtn.frame.size.height/2];
    
        [picBtn.layer setBorderWidth:2];
    
        [picBtn.layer setBorderColor:[[UIColor grayColor] CGColor]];