Ability to set custom header / footer height

This commit is contained in:
Roman Efimov
2014-01-18 13:58:45 -08:00
parent b36dee2c62
commit 6e62348bd5
3 changed files with 24 additions and 1 deletions

View File

@@ -401,6 +401,10 @@
else if (section.headerTitle.length)
return self.defaultTableViewSectionHeight;
if (section.headerHeight != RETableViewSectionFooterHeightAutomatic) {
return section.headerHeight;
}
// Forward to UITableView delegate
//
if ([self.delegate conformsToProtocol:@protocol(UITableViewDelegate)] && [self.delegate respondsToSelector:@selector(tableView:heightForHeaderInSection:)])
@@ -417,6 +421,10 @@
else if (section.footerTitle.length)
return self.defaultTableViewSectionHeight;
if (section.footerHeight != RETableViewSectionFooterHeightAutomatic) {
return section.footerHeight;
}
// Forward to UITableView delegate
//
if ([self.delegate conformsToProtocol:@protocol(UITableViewDelegate)] && [self.delegate respondsToSelector:@selector(tableView:heightForFooterInSection:)])

View File

@@ -28,6 +28,9 @@
@class RETableViewManager;
@class RETableViewCellStyle;
static CGFloat const RETableViewSectionHeaderHeightAutomatic = DBL_MAX;
static CGFloat const RETableViewSectionFooterHeightAutomatic = DBL_MAX;
/**
Table view section.
*/
@@ -48,6 +51,16 @@
*/
@property (copy, readwrite, nonatomic) NSString *footerTitle;
/**
The height of the header of the specified section of the table view.
*/
@property (assign, readwrite, nonatomic) CGFloat headerHeight;
/**
The height of the footer of the specified section of the table view.
*/
@property (assign, readwrite, nonatomic) CGFloat footerHeight;
/**
A view object to display in the header of the specified section of the table view.
*/

View File

@@ -69,7 +69,9 @@
if (!self)
return nil;
self.mutableItems = [[NSMutableArray alloc] init];
_mutableItems = [[NSMutableArray alloc] init];
_headerHeight = RETableViewSectionHeaderHeightAutomatic;
_footerHeight = RETableViewSectionFooterHeightAutomatic;
return self;
}