씬디의 블로그
[UIKit] UISwitch에 대한 UI 속성 본문

Swift

https://developer.apple.com/documentation/uikit/uiswitch/1623686-seton
setOn(_:animated:) | Apple Developer Documentation
Sets the state of the switch to the on or off position, optionally animating the transition.
developer.apple.com
toggleButton.setOn(true, animated: true)
setOn(true)
: 스위치가 켜있는 상태
toggleButton.setOn(false, animated: true)
setOn(false)
: 스위치가 꺼져있는 상태
toggleButton.setOn(true, animated: true)
animated: true/false
스위치가 on, off 할 수 있게 동작 가능 여부
toggleButton.setOn(false, animated: true)
toggleButton.onTintColor = .red
toggleButton.thumbTintColor = .blue
onTintColor는 on되어있는 상태니까 제일 많이 보이는 영역의 색이라고 기억하면 될 것 같고
tumbTintColor는 엄지처럼 동그란 아이의 영역이라고 기억하면 될 것 같다
내맘이니까


'App > Swift' 카테고리의 다른 글
[UIKit] UITextField Border Style 테두리 없애기 (0) | 2024.01.13 |
---|---|
[UIKit] UITextField Left padding (1) | 2024.01.13 |
[UIKit] Dynamic height (cell의 높이를 동적으로 바꾸는 동작) (0) | 2024.01.09 |
[UIKit] UITableViewController 필수 메서드 (0) | 2024.01.07 |
[UIKit] UITableView content [Dynamic Prototypes, Static Cells] (1) | 2024.01.07 |