Skip to content

Instantly share code, notes, and snippets.

@FabiolaRamirez
Last active June 6, 2019 22:23
Show Gist options
  • Save FabiolaRamirez/4de13a15cff62fe1b0fafd6685a52e07 to your computer and use it in GitHub Desktop.
Save FabiolaRamirez/4de13a15cff62fe1b0fafd6685a52e07 to your computer and use it in GitHub Desktop.
// EL METODO DEL FOOTER QUE TIENE TODO
func configureFooter() {
if currentTab == .personalLoans || (CreditSesameRestClient.shared.canShowCreditCardsFilter && TestingManager.shared.newCCFilteringVariation == Variations.variation) {
tableView.tableFooterView = nil
return
}
let offersFooterView = UIView.loadNib("OffersFooterView")
offersFooterView.backgroundColor = UIColor.creditSesameLightGrayBackgroundColor
let balanceButton = offersFooterView.buttonWithTag(11)!
balanceButton.addTarget(self, action: #selector(browseCategories(button:)), for: .touchUpInside)
balanceButton.accessibilityLabel = NSLocalizedString("Balance Transfer", comment: "BT Cards Header")
let zeroPercentButton = offersFooterView.buttonWithTag(12)!
zeroPercentButton.addTarget(self, action: #selector(browseCategories(button:)), for: .touchUpInside)
zeroPercentButton.accessibilityLabel = NSLocalizedString("ZeroPurchaseAPR", comment: "0% Intro Purchase APR Header")
let rewardsButton = offersFooterView.buttonWithTag(13)!
rewardsButton.addTarget(self, action: #selector(browseCategories(button:)), for: .touchUpInside)
rewardsButton.accessibilityLabel = NSLocalizedString("Rewards", comment: "Rewards Cards Header")
let titleLabel = offersFooterView.labelWithTag(10)
titleLabel?.font = UIFont.latoBold(20)
titleLabel?.textColor = UIColor.creditSesameDarkTextColor
titleLabel?.text = NSLocalizedString("Credit Card Categories", comment: "Footer categories")
let height = offersFooterView.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize).height
let footerView = UITableViewHeaderFooterView(frame: CGRect(x: 0, y: 0, width: 0, height: height))
footerView.backgroundColor = UIColor.clear
footerView.addSubview(offersFooterView)
offersFooterView.clipsToBounds = true
offersFooterView.snp.makeConstraints { (make) in
make.edges.equalToSuperview()
}
let disclosureContainerView = offersFooterView.viewWithTag(14)
let disclosureView = disclosureFooterView()
disclosureContainerView?.addSubview(disclosureView)
disclosureView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
tableView.tableFooterView = footerView
}
// MI NUEVO METODO DEL FOOTER QUE EXTRAJE PARTE DE ARRIBA
func configureFooterSimple() {
let offersFooterView = UIView.loadNib("OffersFooterViewSimple")
let height = offersFooterView.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize).height
let footerView = UITableViewHeaderFooterView(frame: CGRect(x: 0, y: 0, width: 0, height: 112))
footerView.backgroundColor = UIColor.clear
let disclosureContainerView = offersFooterView.viewWithTag(14)
let disclosureView = disclosureFooterView()
disclosureContainerView?.addSubview(disclosureView)
offersFooterView.clipsToBounds = true
disclosureView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}
tableView.tableFooterView = footerView
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment