diff --git a/RETableViewManager/RETableViewCell.m b/RETableViewManager/RETableViewCell.m index eeab947..80ce2c6 100644 --- a/RETableViewManager/RETableViewCell.m +++ b/RETableViewManager/RETableViewCell.m @@ -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; diff --git a/RETableViewManager/RETableViewCellStyle.h b/RETableViewManager/RETableViewCellStyle.h index c06b98e..43ad2b2 100644 --- a/RETableViewManager/RETableViewCellStyle.h +++ b/RETableViewManager/RETableViewCellStyle.h @@ -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; diff --git a/RETableViewManager/RETableViewCellStyle.m b/RETableViewManager/RETableViewCellStyle.m index d14fcd4..870ce46 100644 --- a/RETableViewManager/RETableViewCellStyle.m +++ b/RETableViewManager/RETableViewCellStyle.m @@ -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)];