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