iosxcodexlpagertabstrip

XLPagerTabStrip Change Icon Size


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.


Solution

  • 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
    
        }