
UIDrawTextLayout 클래스의 setColor 메서드는 UIColor 객체를 파라미터로 받습니다.
UIColor 객체를 생성하여 setColor 메서드에 전달하면 텍스트의 색상을 변경할 수 있습니다.
예를 들어, 다음과 같이 UIColor 객체를 생성하여 setColor 메서드에 전달할 수 있습니다.
#hostingforum.kr
swift
let textLayout = UIDrawTextLayout()
let color = UIColor.red // UIColor 객체 생성
textLayout.setColor(color)
또는 UIColor 객체를 생성할 때도 다양한 파라미터를 사용할 수 있습니다.
예를 들어, RGB 색상을 지정할 때는 다음과 같이 UIColor 객체를 생성할 수 있습니다.
#hostingforum.kr
swift
let textLayout = UIDrawTextLayout()
let color = UIColor(red: 1.0, green: 0.0, blue: 0.0, alpha: 1.0) // RGB 색상
textLayout.setColor(color)
또는 UIColor 객체를 생성할 때는 시스템 색상도 사용할 수 있습니다.
#hostingforum.kr
swift
let textLayout = UIDrawTextLayout()
let color = UIColor.systemRed // 시스템 색상
textLayout.setColor(color)
2025-06-20 13:21