自从我使用XLPagerTabStrip以来已经很长时间了,我对此没有任何问题。但是突然间,它如标题中所述崩溃了。
致命错误:由提供的每个视图控制器 PagerTabStripDataSource的viewControllers(for :)方法必须符合 IndicatorInfoProvider:文件
该问题已经问过here,但没有一个答案有效。我也已经重新安装了pod。但仍然无法正常工作。
这是我的两个使用XLPagerStrip的Controller,我已经在两个类中都实现了信息提供程序。
class TopUpTransactionHistoryViewController: UIViewController, IndicatorInfoProvider, TopUpTransactionVTADelegate {
@IBOutlet weak var trxListTableView: UITableView!
@IBOutlet weak var selectBankBtn: UIButton!
@IBOutlet weak var selectStatusBtn: UIButton!
@IBOutlet weak var tableActivityIndicator: UIActivityIndicatorView!
var topupListVTA: TopUpTransactionVTA?
var lastItemClicked: TopUpTransactionData?
// for bank filtering
var lastSelBank = 0
var banks = ViseePayFilterData.getBankFilterList()
// for status filtering
var lastSelStatus = 0
var stats = ViseePayFilterData.getStatusFilterList()
func indicatorInfo(for pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo {
return IndicatorInfo(title: "Pengisian Saldo")
}
override func viewDidLoad() {
super.viewDidLoad()
getPendingTransaction()
}
}
}
和
class ViseePayViewController: ButtonBarPagerTabStripViewController, GetBalanceDelegate {
@IBOutlet weak var headerImgBg: UIImageView!
@IBOutlet weak var balanceLabel: UILabel!
@IBOutlet weak var accountNumberLabel: UILabel!
private var getBalanceRequest: GetViseePayBalance?
private var topUpchildVC: UIViewController?
var itemInfo = IndicatorInfo(title: "ViseePay")
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
setNavigationTransparent()
showLogoInNavigation()
}
private func showLogoInNavigation() {
let viseePayLogo = UIImage(named: "logoViseePay")
let imgView = UIImageView(image: viseePayLogo)
imgView.dropWhiteShadow(radius: 6.5)
self.navigationItem.titleView = imgView
}
private func setNavigationNormal(){
self.navigationController?.navigationBar
.setBackgroundImage(nil, for: UIBarMetrics.default)
}
private func makeBgFaded(){
headerImgBg.backgroundColor = UIColor.colorPrimary()
let gradient = CAGradientLayer()
gradient.frame = headerImgBg.bounds
gradient.colors = [UIColor.white.cgColor, UIColor.clear.cgColor]
gradient.startPoint = CGPoint(x: 0.0, y: 0.6)
gradient.endPoint = CGPoint(x: 0.0, y: 1.0)
headerImgBg.layer.mask = gradient
}
private func makeCardRounded(){
let radius = CGFloat(8)
cardHeaderWrapperLayout.layer.cornerRadius = radius
cardHeaderWrapperLayout.layer.masksToBounds = true
cardHeaderLayout.layer.cornerRadius = radius
cardHeaderLayout.layer.masksToBounds = true
}
private func makeCardBgBlurry(){
if !UIAccessibilityIsReduceTransparencyEnabled() {
cardHeaderLayout.backgroundColor = .clear
let blurEffect = UIBlurEffect(style: .extraLight)
let blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = cardHeaderLayout.bounds
blurEffectView.alpha = 0.95
blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
cardHeaderLayout.insertSubview(blurEffectView, at: 0) }
}
private func showLoadingCardHeader(){
cardHeaderContent.isHidden = true
cardHeaderBottom.isHidden = true
balanceLayout.isHidden = true
balanceLoadingIndicator.startAnimating()
cardHeaderLoadingIndicator.startAnimating()
}
}
extension ViseePayViewController: IndicatorInfoProvider {
func indicatorInfo(for pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo {
return itemInfo
}
}
还有另一种方法可以解决此问题?谢谢!