Slide 38
Slide 38 text
%POU3FQFBU:PVSTFMG
ࣝγεςϜʹ͓͍ͯ୯ҰͰɺᐆດ͕͞ͳ͘ɺ৴པͰ͖ΔදݱͰͳͯ͘ͳΒͳ͍
class ViewController: UIViewController {
enum LabelType {
case title
case author
var font: UIFont {
/* */
}
var textColor: UIColor {
/* */
}
}
func setLabelTextVisual(on label: UILabel, as type:
LabelType) {
label.font = type.font
label.textColor = type.textColor
}
@IBAction func resetLabelTextVisual(sender: Any) {
setLabelTextVisual(on: titleLabel, as: .title)
setLabelTextVisual(on: authorLabel,
as: .author)
}
}
ࣝʹԠͨ͡Γସ͑Λఆٛ
ॏෳίʔυΛݮ