Ghanshyam Tomar
Ghanshyam Tomar

Reputation: 770

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.

Upvotes: 2

Views: 144

Answers (3)

Ghanshyam Tomar
Ghanshyam Tomar

Reputation: 770

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]];

Upvotes: 1

Yagnesh Dobariya
Yagnesh Dobariya

Reputation: 2251

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

Upvotes: 1

Pramod Tapaniya
Pramod Tapaniya

Reputation: 1266

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

Upvotes: 1

Related Questions