Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set a corner radius for a custom cell

enter image description here

Here is my sample output ,in that below details there are three cells ,i have set corner radius for each custom cells.but it not working correctly .The corner radius for first cell is not working ,for the second cell the top right and top left is working ,please say what to do for this

   -(void)layoutSubviews
     {
[super layoutSubviews];
self.backgroundColor = [UIColor clearColor];
self.contentView.layer.cornerRadius =5;
self.contentView.layer.masksToBounds = YES;

 }

i have applied this above code to my cell class file

like image 253
Chandrika Visvesh Avatar asked Nov 14 '25 18:11

Chandrika Visvesh


1 Answers

In cellForRowAtIndexPath Use

    cell.layer.cornerRadius=5

If you have different cells in different sections then make sure that this code is written for all sections

like image 135
Reshmi Majumder Avatar answered Nov 17 '25 08:11

Reshmi Majumder



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!