이미지 선택, 투명도, 랜덤 숫자

강남준·2022년 11월 29일
0

imageLiteral & colorLiteral

  • Asset에 있는 이미지나 색을 쉽고 직관적으로 바로 선택 가능
imageView.image = #imageLiteral()

self.view.backgroundColor = #colorLiteral()

  • 다른 방법
imageView = UIImage(named : "diceTwo") 
self.view.backgroundColor = UIColor(red: 0.9, green: 0.3, blue: 0.5, alpha: 0.3)

opacity

  • UIView의 투명도 조절하기
imageView.layer.opacity = 0.5

random

leftDiceNumber = Int.random(in: 0...5)

0과 5사이에 있는 수를 무작위로 추출

profile
안녕하세요:)

0개의 댓글