-2

Here is my code:

UIView * ivHeaderContainer = [[UIView alloc]init];
UIView * ivFooterContainer = [[UIView alloc]init];
UIImageView * ivHeader = [[UIImageView alloc]init];
UIImageView * ivFooter = [[UIImageView alloc]init];

PO1(self.tableHeaderView);
PO1(ivHeaderContainer);
self.tableHeaderView = ivHeaderContainer;
PO1(self.tableHeaderView);
PO1(ivHeaderContainer);
[ivHeaderContainer addSubview:ivHeader];
PO1(self.tableHeaderView);

Here is the log in console:

(41)> ivHeaderContainer: <UIView: 0x1a497700; frame = (0 0; 0 0); layer = <CALayer: 0x1a497760>>
2014-01-24 12:15:11.441 domainname[13727:40ab] <0x1a490220 Image+imageFile.m:(30)> [NSString stringWithString: self.fullFileName]: /private/var/mobile/Applications/BF1CCA03-2406-4FC9-BE33-298AD6DBAC2C/tmp/http%3A%2F%2Fimg.agoda.net%2Fhotelimages%2F475%2F4755%2F4755_08091300010092992_std.jpg.png
2014-01-24 12:37:32.767 [13727:60b] <0x165ff400 BGTableViewWithBackgroundAndTopAndBottom.m:(43)> self.tableHeaderView: <UIView: 0x1a497700; frame = (0 35; 320 0); layer = <CALayer: 

So, after the line

self.tableHeaderView = ivHeaderContainer

the value of ivHeaderContainter is suddenly [0, 35, 320, 0] instead of [0, 0, 0, 0]. Don't know where the number 35 comes from.

Only happens on one xib. What could be the reason ?

Function PO1 (print object 1) simply print the stuff out.

This only happens when the table is grouped. But other grouped table doesn't have this issue.

user4951
  • 32,206
  • 53
  • 172
  • 282

1 Answers1

0

I declared the future tableViewHeader with this

UIView * ivHeaderContainer = [[UIView alloc]initWithFrame:CGRectMake(0,0,.01,.01)];

Instead of

UIView * ivHeaderContainer = [[UIView alloc]init];

Problem is magically solved. It follows solutions here: Why is there extra padding at the top of my UITableView with style UITableViewStyleGrouped in iOS7

Next question. Why?

Community
  • 1
  • 1
user4951
  • 32,206
  • 53
  • 172
  • 282