Plain style tableView禁止header和footer浮动的方法
继承UITableView类,在子类覆写方法- (BOOL)allowsHeaderViewsToFloat
和- (BOOL)allowsHeaderViewsToFloat
,代码如下:
@implementation DQNoHeaderFloatingTableView
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
}
return self;
}
- (BOOL)allowsHeaderViewsToFloat {
return NO;
}
- (BOOL)allowsFooterViewsToFloat {
return NO;
}
@end