Skip to content

Instantly share code, notes, and snippets.

@marcosatanaka
Last active August 7, 2018 00:40
Show Gist options
  • Save marcosatanaka/d0385ee70c2762512f2d5957ab18496f to your computer and use it in GitHub Desktop.
Save marcosatanaka/d0385ee70c2762512f2d5957ab18496f to your computer and use it in GitHub Desktop.
import UIKit
class OnboardingCollectionViewCell: UICollectionViewCell {
static let reuseIdentifier = "OnboardingCell"
@IBOutlet weak var pageImage: UIImageView!
@IBOutlet weak var pageTitle: UILabel!
@IBOutlet weak var pageDescription: UILabel!
@IBOutlet weak var startButton: UIButton!
func fill(with data: OnboardingModel) {
// Se quiser imagem no background, descomentar as linhas abaixo
// e criar atributo backgroundImage no OnboardingModel
// let backgroundImage = UIImageView(image: UIImage(named: data.backgroundImage))
// backgroundImage.contentMode = .scaleAspectFill
// backgroundView = backgroundImage
backgroundColor = data.backgroundColor
pageImage.image = UIImage(named: data.iconImage)
pageTitle.text = data.title
pageDescription.text = data.content
startButton.alpha = data.hideButton ? 0 : 1
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment