Prashant Sharma Prashant Sharma - 6 months ago 17
Objective-C Question

How to convert tableview cell to rounded corner with shadow in iOS 9.0 or later

enter image description here

I want to show tableview cell like above image.
Please help me out.


If you use normal table view cell

cell.contentView.layer.cornerRadius = 7.0f;
cell.contentView.layer.masksToBounds = YES;

If you use custom table view cell

cell.layer.cornerRadius = 7.0f;
cell.layer.masksToBounds = YES;

clear background color of UITableView in storyboard. Then you will be able to see the change.

For Cell Row Height

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  return 44;  //It default size.If you want to change to other size you can change.