Parth Bhatt
Parth Bhatt

Reputation: 19469

Grouped UITableView with multiple sections creating problem in iPhone SDK

In my iPhone app, I am having a grouped table view. I have used viewForHeaderInSection method to change the font color and size of font of section headers.

I have 4 sections in the tableview.

Problem

If there is no data in Section 0 and section 1 then too Section 2 starts to display in table somewhere near center of the view instead of top of the screen.

I want that when section 0 and section 1 cells are empty the section 2 should come at the top of the view as if it is section 0.

How should I proceed?

Upvotes: 0

Views: 674

Answers (2)

Morion
Morion

Reputation: 10860

It is just a suggestion, but you can try to set the height of the view of your headers to 0 if the section is empty.

Upvotes: 0

Ishu
Ishu

Reputation: 12787

for this purpose,

you need to check weather data exist or not suppose you display data from array so,check

([array count]>0)

check this according to you and now,when you return the number of section then you cant

return 4;[hard code].

dynamically check data then according to condition return the number of section.

Upvotes: 1

Related Questions