【发布时间】:2018-08-29 06:46:50
【问题描述】:
【问题讨论】:
标签: ios image tabbar react-native-navigation
【问题讨论】:
标签: ios image tabbar react-native-navigation
您可以使用 WebImage 并使用 SDWebImage 加载它。
https://github.com/rs/SDWebImage
因此,一旦它加载并且您在其方法中获得 UIImage 的对象,您可以检查 UIImage 对象不应为 nil 如果不是 nil,则将 UIImage 设置为您的标签栏项目图像。
imageView.sd_setImageWithURL(NSURL(string: urlString), completed: {
(image, error, cacheType, url) in
// Change tabbar item image here....
tabHome.image=image?.withRenderingMode(.alwaysOriginal) // deselect image
tabHome.selectedImage = image?.withRenderingMode(.alwaysOriginal) // select image
})
【讨论】:
这可以通过UITabBarItem 在 iOS 中实现
您需要为您的业务选择 UITabBarItem 构造函数并设置图像
UITabBarItem(title: String?, image: UIImage?, selectedImage: UIImage?)
UITabBarItem(title: String?, image: UIImage?, tag: Int)
【讨论】: