0

Hi I am using XLPagerTabStrip to display android like fragment tabs on my ios app (xcode 10.2.1) (IOS 12.3.1)

I am trying to change the icon size. I am using the following code to declare the icons

return IndicatorInfo(image: UIImage(named: "ic_chats"), highlightedImage: UIImage(named: "ic_chats"), userInfo: Any?.self)

I tried going to the assets folder and changing the icon size there from 90x90 to 70x70 but it did not work.

DragonFire
  • 3,722
  • 2
  • 38
  • 51

2 Answers2

3

Found the answer we can use the following code (not sure if this is proper but doing the trick)

Add the following code

    newCell?.transform = CGAffineTransform(scaleX: 0.7, y: 0.7)
    oldCell?.transform = CGAffineTransform(scaleX: 0.7, y: 0.7)

At the end of the following block in the class CommunicateViewController: ButtonBarPagerTabStripViewController

    // Changing item text color on swipe
    changeCurrentIndexProgressive = { [weak self] (oldCell: ButtonBarViewCell?, newCell: ButtonBarViewCell?, _: CGFloat, changeCurrentIndex: Bool, _: Bool) -> Void in
        guard changeCurrentIndex == true else { return }
        oldCell?.label.textColor = .white
        newCell?.label.textColor = self?.colorAccent

        Enter The Code Here

    }
DragonFire
  • 3,722
  • 2
  • 38
  • 51
1

DragonFire's answer seems to cause some bug for me, I edited to only apply the transform on the imageView and it works better now.

Add the following code

newCell?.imageView.transform = CGAffineTransform(scaleX: 0.7, y: 0.7)
oldCell?.imageView.transform = CGAffineTransform(scaleX: 0.7, y: 0.7)

inside the changeCurrentIndexProgressive block :

changeCurrentIndexProgressive = { [weak self] (oldCell: ButtonBarViewCell?, newCell: ButtonBarViewCell?, _: CGFloat, changeCurrentIndex: Bool, _: Bool) -> Void in
    guard changeCurrentIndex == true else { return }

    // enter The Code Here

}
Axel
  • 1,053
  • 9
  • 19