From ad4b564756c7f644d1028f3340bc9cfd4ecef599 Mon Sep 17 00:00:00 2001 From: Sergey Demchenko Date: Sat, 8 Aug 2015 13:36:10 -0700 Subject: [PATCH] Allow to specify tab button image. --- .../Controllers/XLButtonBarPagerTabStripViewController.m | 9 +++++++++ .../XL/Controllers/XLPagerTabStripViewController.h | 1 + 2 files changed, 10 insertions(+) diff --git a/XLPagerTabStrip/XL/Controllers/XLButtonBarPagerTabStripViewController.m b/XLPagerTabStrip/XL/Controllers/XLButtonBarPagerTabStripViewController.m index abbc7d9..d1ef5cf 100644 --- a/XLPagerTabStrip/XL/Controllers/XLButtonBarPagerTabStripViewController.m +++ b/XLPagerTabStrip/XL/Controllers/XLButtonBarPagerTabStripViewController.m @@ -207,6 +207,15 @@ [buttonBarCell.label setText:[childController titleForPagerTabStripViewController:self]]; + if ([childController respondsToSelector:@selector(imageForPagerTabStripViewController:)]) { + UIImage *image = [childController imageForPagerTabStripViewController:self]; + buttonBarCell.imageView.image = image; + } + + if ([childController respondsToSelector:@selector(highlightedImageForPagerTabStripViewController:)]) { + UIImage *image = [childController highlightedImageForPagerTabStripViewController:self]; + buttonBarCell.imageView.highlightedImage = image; + } if (self.isProgressiveIndicator) { if (self.changeCurrentIndexProgressiveBlock) { diff --git a/XLPagerTabStrip/XL/Controllers/XLPagerTabStripViewController.h b/XLPagerTabStrip/XL/Controllers/XLPagerTabStripViewController.h index b76a1ef..0880d24 100644 --- a/XLPagerTabStrip/XL/Controllers/XLPagerTabStripViewController.h +++ b/XLPagerTabStrip/XL/Controllers/XLPagerTabStripViewController.h @@ -40,6 +40,7 @@ @optional - (UIImage *)imageForPagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController; +- (UIImage *)highlightedImageForPagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController; - (UIColor *)colorForPagerTabStripViewController:(XLPagerTabStripViewController *)pagerTabStripViewController; @end