我用以下代码更改UITableView,

CHANGE_FRAME_HEIGHT(header, CGRectGetMaxY(_lbFollowing.frame)+8)
_tableView.tableHeaderView= header;


但是我每次调用这些代码时tableivew的contentSize都会增加0.5

2015-11-17 12:30:41.881 yueban[42934:3092288] -[UserInfoHeaderView layoutSelfView] [Line 245] <UITableView: 0x61d00023e680; frame = (0 0; 320 519); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x604000298610>; layer = <CALayer: 0x6030002737c0>; contentOffset: {0, 0}; contentSize: {320, 474.00299978256226}>
<UserInfoHeaderView: 0x6160001d8880; frame = (0 0; 320 246.5); layer = <CALayer: 0x603000272f50>>

2015-11-17 12:30:41.903 yueban[42934:3092288] -[UserInfoHeaderView layoutSelfView] [Line 247] <UITableView: 0x61d00023e680; frame = (0 0; 320 519); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x604000298610>; layer = <CALayer: 0x6030002737c0>; contentOffset: {0, 0}; contentSize: {320, 474.50299978256226}>


为什么??

最佳答案

得到答案。重置reloadData后,我需要致电tableHeaderView

_tableView.tableHeaderView=self;
[_tableView reloadData];

关于ios - 更改tableHeaderView框架,每次将tableview的contentSize增加0.5,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33750056/

10-12 17:06