project/Kuring(공지알림)

iOS UIButton 90도 회전시키기

lgvv 2021. 12. 20. 01:55

iOS UIButton 90도 회전시키기

 

CGAffineTransform 사용.

 

   private let menuButton = UIButton().then {
        // 3점 모양(햄버그 버튼)
        $0.setImage(UIImage(systemName: "ellipsis"), for: .normal)
        $0.contentMode = .scaleAspectFit
        $0.tintColor = .black
        $0.transform = CGAffineTransform(rotationAngle: .pi * 0.5)
    }