Created
January 28, 2019 21:11
-
-
Save FabiolaRamirez/4d6aaf82a22df673bbdb7aee077baea0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func configureHeader() { | |
| var offersHeaderView = UIView() | |
| // control | |
| offersHeaderView = UIView.loadNib("AdvertisersDisclosureHeaderView") | |
| // variation | |
| offersHeaderView = UIView.loadNib("ContentHeaderView") | |
| var messageLabel = offersHeaderView.labelWithTag(12) | |
| messageLabel?.font = UIFont.lato(16) | |
| messageLabel?.textColor = UIColor.creditSesameDarkTextColor | |
| switch offerPage { | |
| case .bestCardsBT: | |
| messageLabel?.text = NSLocalizedString("BalanceTransfer", comment: "BT Cards Header") | |
| case .bestCardsZeroPercent: | |
| messageLabel?.text = NSLocalizedString("IntroPurchase", comment: "0% Intro Purchase APR Header") | |
| case .bestCardsRewards: | |
| messageLabel?.text = NSLocalizedString("RewardsOffer", comment: "Rewards Cards Header") | |
| default: | |
| messageLabel = nil | |
| } | |
| offersHeaderView.layoutIfNeeded() | |
| //end | |
| offersHeaderView.backgroundColor = UIColor.clear | |
| let height = offersHeaderView.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize).height | |
| let headerView = UITableViewHeaderFooterView(frame: CGRect(x: 0, y: 0, width: 0, height: height)) | |
| headerView.backgroundColor = UIColor.clear | |
| headerView.addSubview(offersHeaderView) | |
| offersHeaderView.clipsToBounds = true | |
| offersHeaderView.snp.makeConstraints { (make) in | |
| make.edges.equalToSuperview() | |
| } | |
| let button = offersHeaderView.buttonWithTag(10) | |
| button?.setThemeAdvertiserDisclosure() | |
| button?.backgroundColor = UIColor.clear | |
| button?.addTarget(self, action: #selector(showAdvertisersDisclosureTooltip), for: .touchUpInside) | |
| disclosureButton = button | |
| tableView.tableHeaderView = headerView | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment