1

I am using corner radius to set rounded border of UITableView, Following is my code

self.tableView.layer.cornerRadius = 8.0
self.tableView.layer.masksToBounds = true

But its showing like this without rounded corner in bottom :(

enter image description here

rmaddy
  • 307,833
  • 40
  • 508
  • 550
Abhishek
  • 1,632
  • 2
  • 17
  • 29

2 Answers2

0

If your table height is proper then, your second cell inner view's height is greater that its height.

Try removing your inner view from cell or if there is no inner view then check your tableview height.

Thanks.

0

I set up a quick demo project with a sample viewcontroller containing the following code:

@IBOutlet var tableView: UITableView! {
    didSet {
        tableView.rowHeight = 44
    }
}

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 2 }
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    return tableView.dequeueReusableCellWithIdentifier("CustomCell", forIndexPath: indexPath)
}

override func viewDidLoad() {
    super.viewDidLoad()
    tableView.tableFooterView = UIView()
}

override func viewDidLayoutSubviews() {
    super.viewDidLayoutSubviews()
    tableView.layer.cornerRadius = 10
}

In storyboard the viewcontroller looks like this:

storyboard

As you can see the tableview has a fixed height of 128pt. Although the tableview contains only two rows with a height of 44pt each (88pt in total) the tableview's corners look fine. So there has to be some other issue in your code.

simulator

André Slotta
  • 13,344
  • 2
  • 19
  • 31