Reputation: 4082
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.
Upvotes: 0
Views: 740
Reputation: 1053
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
}
Upvotes: 1
Reputation: 4082
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
}
Upvotes: 3