Only Bottom Rounded Corners for UITableView

Discussion in 'iOS Programming' started by mdhansen5, May 4, 2012.

  1. mdhansen5 macrumors member

    Joined:
    Nov 22, 2010
    Location:
    Colorado
    #1
    For the UI of the app I'm working on, I'm trying to create rounded corners for the view controller. I have a UINavigationBar and a UITableView. I've already rounded the top 2 corners of the UINavigationBar manually by using a custom background with UIAppearance stuff. Now I want to round the bottom 2 corners of the UITableView so it looks nice. The code I have right now rounds all 4 corners. Anyone know how I can only round the bottom 2?

    Here's what I have added right now in my ViewDidLoad method of the UITableViewController. And I have QuartzCore imported.

    _tasksTableView.layer.cornerRadius=5;

    This line rounds all 4 corners of the UITableView, so I have a rounded UINavigation Bar and a rounded Table View. Doesn't look very good. I'd like to have the 4 corners of the app's window to be rounded.

    Thanks to anyone that can help out.
     
  2. admanimal macrumors 68040

    Joined:
    Apr 22, 2005
    #2
    How about adjusting the size and y position of the table view so that the top corners are hidden under the nav bar? You'll just have to modify the contentInset (I think that's the one) property of the table view so the content of the table view isn't also hidden under the nav bar.
     
  3. mdhansen5 thread starter macrumors member

    Joined:
    Nov 22, 2010
    Location:
    Colorado
    #3
    Great idea. I'll give it a try. Thanks!
     

Share This Page