我正在使用 View pager 应用程序制作应用程序,我正在使用 XLPagerTabStrip 库来制作它。它适用于 Viewpager 项目中的 Title。我想在其中添加图标和相应的标签。
问问题
1830 次
1 回答
7
崩溃背后的原因是 ButtonCell.xib 中缺少 UIImageView。
解决方案是:
- 打开ButtonBarViewCell类,在xcode的顶部导航菜单中,点击ButtonBarViewCell。在那里你可以看到ButtonCell.xib。
- 打开 ButtonCell.xib,将 UIImage 视图拖放到单元格的中心。应用约束。并将其连接到 IBOutlet imageView。
- 回到 ButtonBarViewCell 类并在 func willMove(toSuperview newSuperview: UIView?) 函数中添加这行代码。
如果 imageView.superview != nil { contentView.addSubview(imageView) }
4.回到实现页面的类,添加这段代码
func indicatorInfo(for pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo {
return IndicatorInfo(title: "",image: UIImage(named: "camera.png"))
}
5.完成
`
于 2017-03-21T10:09:42.383 回答