Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

pinsrw

macrumors regular
Original poster
May 30, 2010
194
0
Hi all,

I've set up a UITableView in a navigation-based iPhone app, and I've been surprised to see that there is a blank area within the rectangle of the UITableView. It's about 20 pixels high, or the height of one row.

I assumed it was the footer but I set up the methods to report a zero footer height and to provide a nil footer UIView, and there is no improvment.

Anybody know what that blank area is, if it's not the footer?

Thanks.
 
20 pixels is the height of the status bar.

Well what I mean is, it has these regions:

Code:
[Top navigation bar]
[Some buttons of mine]
[UITableView line 1]
[UITableView line 2]
[UITableView line 3]
[UITableView line 4]
[Blank area that is within UITableView rectangle and on-screen]

When I scroll the UITableView, none of the lines (e.g. if there are 20) appear in this blank area.

Here's something odd: I've found I can place buttons and other widgets on top of this blank area in order to make use of the unused space. Is that to be expected?
 
So, you have no status bar in your window, right? So, you need to adjust the size of your table view to take up the space that used to be occupied by that.
 
So, you have no status bar in your window, right? So, you need to adjust the size of your table view to take up the space that used to be occupied by that.

I did that but the lower 20 pixels still aren't used. That's why I put a button and label above that area of the UITextView. Feels like a kludge though...
 

You are right, I misspoke and meant UITableView.

In the attached screenshot you can see that I have the UITableView selected. The area of the UITableView that is always blank is the lower 20 pixels, so I put a label on top of that area in order to make use of that area.

When I do command-R in IB, the UITableView works fine. It's only when it's used in the context of the larger navigation app that there's a blank area.
 

Attachments

  • this2.png
    this2.png
    17.9 KB · Views: 472
Well, that's more than 20 pixels high, so there goes my theory. (Also, didn't realize the table was not occupying the entire view.)

Is this just an issue with how it shows up in IB or do you see the gap with the app running as well?

Remove the label and attach a new screenshot, along with the Size Inspector settings as well.
 
Is the table grouped or plain?

Are there only four rows in the table?

Obviously if the height of the table is more than the height of its rows there will be empty space. Is that what you're seeing?
 
Well, that's more than 20 pixels high, so there goes my theory.
OK, here's what I've done. I moved the table up and put a label just below it. The background of the label is gray. Running it in IB it's clear that these are adjacent. In the code, I set the background of the table to red so that it's clear where it is. But this also shows the basic problem: When run, the table shortens by about 20 pixels, so now there is the blank area between the red table and gray label, which is the subject of this thread. Thus it appears that something is causing the table to shorten at runtime.
 

Attachments

  • IB2.png
    IB2.png
    28.7 KB · Views: 397
  • Running3.png
    Running3.png
    17.8 KB · Views: 319
What are the autoresize settings for your table view? (Which is why I asked earlier for a screenshot of your Settings Inspector as well.)
 
What are the autoresize settings for your table view? (Which is why I asked earlier for a screenshot of your Settings Inspector as well.)

Wow... That was it. I disabled "autoresize subviews" in the view and now the table is the size that I specified in IB.

Thanks for your help on this.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.