图标和它们的颜色会自动更新 | iOS |碳套件
icons and their color are updating automatically | iOS | CarbonKit
我在我的代码中使用 CarbonTabSwipeNavigation(如下所示)。问题是所有图标的颜色都会自动更新(可能是某种默认颜色)。如何解决?
除此之外,我的一个图标正在更新(不知道为什么)。我尝试在应用程序的其他部分使用相同的图标,并且效果非常好。请帮助我。谢谢
weak var tab: CarbonTabSwipeNavigation!
override func viewDidLoad() {
super.viewDidLoad()
let iconNames = ["icn_events", "icn_places", "icn_activities", "icn_clubs"]
var images = [UIImage]()
for icon in iconNames {
if let img = UIImage(named: icon) {
images.append(img)
}
}
let carbonTabSwipeNavigation = CarbonTabSwipeNavigation(items: images, delegate: self)
carbonTabSwipeNavigation.pagesScrollView?.isScrollEnabled = false
carbonTabSwipeNavigation.insert(intoRootViewController: self)
//I'm using following piece of code to fix the color issue (please note, even without this, the image is being updated).
//carbonTabSwipeNavigation.setNormalColor(UIColor(hex: "5603ad"))
//carbonTabSwipeNavigation.setSelectedColor(UIColor(hex: "5603ad"))
carbonTabSwipeNavigation.setTabExtraWidth(45)
tab = carbonTabSwipeNavigation
}
我附上了实际图标及其显示方式的屏幕截图。
它是由于条形色调颜色而发生的。该问题已通过图像渲染模式解决:
let iconNames = ["icn_events", "icn_places", "icn_activities"]
var images = [UIImage]()
for icon in iconNames {
if let img = UIImage(named: icon) {
images.append(img)
}
}
if let img = UIImage(named: "icn_clubs")?.withRenderingMode(UIImageRenderingMode.alwaysOriginal) {
images.append(img)
}
我在我的代码中使用 CarbonTabSwipeNavigation(如下所示)。问题是所有图标的颜色都会自动更新(可能是某种默认颜色)。如何解决? 除此之外,我的一个图标正在更新(不知道为什么)。我尝试在应用程序的其他部分使用相同的图标,并且效果非常好。请帮助我。谢谢
weak var tab: CarbonTabSwipeNavigation!
override func viewDidLoad() {
super.viewDidLoad()
let iconNames = ["icn_events", "icn_places", "icn_activities", "icn_clubs"]
var images = [UIImage]()
for icon in iconNames {
if let img = UIImage(named: icon) {
images.append(img)
}
}
let carbonTabSwipeNavigation = CarbonTabSwipeNavigation(items: images, delegate: self)
carbonTabSwipeNavigation.pagesScrollView?.isScrollEnabled = false
carbonTabSwipeNavigation.insert(intoRootViewController: self)
//I'm using following piece of code to fix the color issue (please note, even without this, the image is being updated).
//carbonTabSwipeNavigation.setNormalColor(UIColor(hex: "5603ad"))
//carbonTabSwipeNavigation.setSelectedColor(UIColor(hex: "5603ad"))
carbonTabSwipeNavigation.setTabExtraWidth(45)
tab = carbonTabSwipeNavigation
}
我附上了实际图标及其显示方式的屏幕截图。
它是由于条形色调颜色而发生的。该问题已通过图像渲染模式解决:
let iconNames = ["icn_events", "icn_places", "icn_activities"]
var images = [UIImage]()
for icon in iconNames {
if let img = UIImage(named: icon) {
images.append(img)
}
}
if let img = UIImage(named: "icn_clubs")?.withRenderingMode(UIImageRenderingMode.alwaysOriginal) {
images.append(img)
}