这里我动态添加标签项,但只显示4项(更多...标签项缺失)。我已经阅读了很多文章和stackOverFlow帖子,但未能找到任何合适的解决方案。到目前为止,这是我的代码......
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
loadDynamicItems()
}
func loadDynamicItems() {
let storyBoard = UIStoryboard(name: "Main", bundle: Bundle.main)
var controllerArray = [UIViewController]()
for i in 1...8 {
let controller = storyBoard.instantiateViewController(withIdentifier: "newsCollection") as! NewsVC
let tabIcon = UIImage.fontAwesomeIcon(name: .addressBook,
textColor: UIColor.black,
size: CGSize(width: 30, height: 30))
controller.tabBarItem = UITabBarItem(title: "item \(i)", image: tabIcon, tag: i)
controllerArray.append(controller)
}
self.setViewControllers(controllerArray, animated: true)
}
但结果似乎是IMAGE
为什么它只显示4项!
它应该加载[More ...]按钮作为第五个孩子,我可以从那里访问其余的项目。 但为什么不存在呢??