开发者

Grouped UITableView with multiple sections creating problem in iPhone SDK

开发者 https://www.devze.com 2023-01-30 06:13 出处:网络
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.

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?


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消