Setting layer out of layer in UIbutton?

168 views Asked by At

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.

3

There are 3 answers

2
Ghanshyam Tomar On BEST ANSWER

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]];
3
Pramod Tapaniya On

For this design put button in one view and set 5 pixel gap between view and button. Than set 2 pixel border of view.

3
Yagnesh Dobariya On

set image through attribute setImage rather then setBackgroundImage, do UIButton backgroungColor clear color, and set border for UIButton