mirror of
https://github.com/zhigang1992/RETableViewManager.git
synced 2026-05-30 18:04:00 +08:00
Move hasBackgroundImage to style object
This commit is contained in:
@@ -49,7 +49,7 @@
|
||||
{
|
||||
self.actionBar = [[REActionBar alloc] initWithDelegate:self];
|
||||
|
||||
if ([self hasCustomBackgroundImage]) {
|
||||
if ([self.tableViewManager.style hasCustomBackgroundImage]) {
|
||||
self.backgroundView = [[UIView alloc] initWithFrame:self.contentView.bounds];
|
||||
self.backgroundView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
_backgroundImageView = [[UIImageView alloc] init];
|
||||
@@ -71,22 +71,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)hasCustomBackgroundImage
|
||||
{
|
||||
return [self.tableViewManager.style backgroundImageForCellType:RETableViewCellFirst] || [self.tableViewManager.style backgroundImageForCellType:RETableViewCellMiddle] || [self.tableViewManager.style backgroundImageForCellType:RETableViewCellLast] || [self.tableViewManager.style backgroundImageForCellType:RETableViewCellSingle];
|
||||
}
|
||||
|
||||
- (void)refreshActionBar
|
||||
{
|
||||
[self.actionBar.navigationControl setEnabled:[self indexPathForPreviousResponder] != nil forSegmentAtIndex:0];
|
||||
[self.actionBar.navigationControl setEnabled:[self indexPathForNextResponder] != nil forSegmentAtIndex:1];
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
[super layoutSubviews];
|
||||
|
||||
if ([self hasCustomBackgroundImage]) {
|
||||
if ([self.tableViewManager.style hasCustomBackgroundImage]) {
|
||||
if (self.row == 0 && self.section.items.count == 1) {
|
||||
_backgroundImageView.image = [self.tableViewManager.style backgroundImageForCellType:RETableViewCellSingle];
|
||||
}
|
||||
@@ -107,6 +96,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)refreshActionBar
|
||||
{
|
||||
[self.actionBar.navigationControl setEnabled:[self indexPathForPreviousResponder] != nil forSegmentAtIndex:0];
|
||||
[self.actionBar.navigationControl setEnabled:[self indexPathForNextResponder] != nil forSegmentAtIndex:1];
|
||||
}
|
||||
|
||||
- (UIResponder *)responder
|
||||
{
|
||||
return nil;
|
||||
|
||||
@@ -40,6 +40,7 @@ typedef enum _RETableViewCellType {
|
||||
@property (assign, readwrite, nonatomic) CGSize textFieldPositionOffset;
|
||||
@property (assign, readwrite, nonatomic) CGFloat cellHeight;
|
||||
|
||||
- (BOOL)hasCustomBackgroundImage;
|
||||
- (UIImage *)backgroundImageForCellType:(RETableViewCellType)cellType;
|
||||
- (void)setBackgroundImage:(UIImage *)image forCellType:(RETableViewCellType)cellType;
|
||||
|
||||
|
||||
@@ -40,6 +40,11 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)hasCustomBackgroundImage
|
||||
{
|
||||
return [self backgroundImageForCellType:RETableViewCellFirst] || [self backgroundImageForCellType:RETableViewCellMiddle] || [self backgroundImageForCellType:RETableViewCellLast] || [self backgroundImageForCellType:RETableViewCellSingle];
|
||||
}
|
||||
|
||||
- (UIImage *)backgroundImageForCellType:(RETableViewCellType)cellType
|
||||
{
|
||||
return [_backgroundImages objectForKey:@(cellType)];
|
||||
|
||||
Reference in New Issue
Block a user