Search code examples
iosuitableviewuiviewcontrollercontainersuicontainerview

How to get a visible frame around a tableview in a container view


the subject says it all: I have a few UITableViews from an iPhone version of my app, that I want to use in the iPad version. For that I'm using the container view object, that "imports" the existing tableview inside of another (bigger) view-controller. Works fine.

But it looks kind of odd, since the borders of the tableview is not displayed. I the image below, you see the layout of the designer on the left side, my containerview on the right side. The "border-frame" on the right side is missing.

I wonder if there is a way to get this border. I the docs I didn't find anything helpful.

Q1: is there a standard property etc to get this frame?

Q2: if not - how would you guys do it? I guess, I could just put an empty view with the frames background color behind the container frame. Any better workaround out there?

enter image description here


Solution

  • I don't know about this issue but I think that it can be solved by using these properties

    tableView.layer.borderColor = THE_COLOR;
    tableView.layer.borderWidth = 1.f;
    

    Also, you may want to use SparkInspector or Reveal to properly debug the UI. You can set and inspect any property that you want at runtime using these apps.