lgvv98

[iOS] UIButton SystemIamge 크기 조절 본문

⚠️ deprecated ⚠️/Calendar

[iOS] UIButton SystemIamge 크기 조절

🥕 캐럿맨 2022. 5. 4. 18:06

UIButton SystemIamge 크기 조절

 

✅ 버튼에 이미지를 넣은 후에 크기 조절하는 코드를 알아보자.

 

✅ 코드

   let taskAddButton: UIButton = {
        let button = UIButton()
        let imageConfig = UIImage.SymbolConfiguration(pointSize: 30, weight: .light)
        let image = UIImage(systemName: "plus", withConfiguration: imageConfig)
        
        button.setImage(image, for: .normal)
        button.tintColor = .white
        button.layer.cornerRadius = 27.5
        
        
        button.backgroundColor = #colorLiteral(red: 0.7332392335, green: 0.7877069116, blue: 0.4581792951, alpha: 1)
        return button
    }()

 

만약 Image에 configuration을 적용하지 않는다면, 안에 이미지가 아주 작게 나타날 것이다!!

버튼의 이미지

 

 

Comments