sabar sabar - 6 months ago 20
iOS Question

Make a button like circle without image in iOS using objective c

I am new in Objective c. I have some buttons on storyboard. I want to make all these buttons like circle.
All buttons are colored without images.
How i can do it using objective c ?

Answer

As you said you want to make all buttons round which is in storyboard, you have to take For in loop:

for(UIButton *btn in [self.view subviews]) {
    if ([btn isKindOfClass:[UIButton class]])
    {
         btn.clipsToBounds = YES;
         btn.layer.cornerRadius = btn.bounds.size.width/2;
    }
}
Comments