μΈν°νμ΄μ€μ νλ¨ κ°μ₯μ리μ νλ μ΄μμ λ²νΌμ νμνλ 컨νΈλ‘€
@MainActor
class UIToolbar : UIView
UIBarButtonItem
ν΄λμ€λ₯Ό μ¬μ©ν¨setItems(_:animated:)
λ©μλλ₯Ό μ¬μ©ν¨UIBarItem
ν΄λμ€λ‘λΆν° μμλ°μ image
μμ±μ μ¬μ©νμ¬ μ€μ ν μ΄λ―Έμ§μμ νμλ¨tintColor
κ° μ΄λ―Έμ§μ μμμ κ²°μ ν¨UIToolbar
λμ UITabBar
ν΄λμ€λ₯Ό μ¬μ©setter
λ©μμ§λ₯Ό 보λ΄κ±°λ νΉμ UIToolbar
μΈμ€ν΄μ€μ 보λ΄μΌν¨μΈκ΄ νλ‘μ([UIToolbar appearance])
- μ± μ 체μμ μΌκ΄μ μΌλ‘ νΉμ UI μμμ μΈκ΄μ μ€μ ν μ μλ λ°©λ²
- μ΄ νλ‘μλ₯Ό μ¬μ©νλ©΄ μ± μ 체μμ μ¬μ©λλ ν΄λ°μ μΈκ΄μ ν λ²μ μ€μ ν μ μμ
iOS 13
μ΄νμλstandardAppearance
λ°compactAppearance
μμ±μ μ¬μ©νμ¬ ν΄λ°λ₯Ό μ¬μ©μ μ μlet toolbarAppearance = UIToolbar.appearance() toolbarAppearance.backgroundColor = UIColor.red
UIBarMetrics.default
λ° landscapePhone
μ λν΄ κ°μ μ§μ ν΄μΌ ν¨UIBarMetrics
- UI μμμ ν¬κΈ°μ μμΉλ₯Ό μ§μ νλλ° μ¬μ©λλ κ°
- λ° λ©νΈλ¦μ€λ ν΄λ°λ λ΄λΉκ²μ΄μ λ°μ κ°μ λ°(Bar)μ μ μ©λλ©°, ν΄λΉ λ°μ ν¬κΈ° λ° μμΉμ λ°λΌ λ€λ₯Έ μΈκ΄ μ€μ μ μ μ©ν μ μλλ‘ ν¨
// Using the appearance proxy to set different >background colors for different bar metrics let toolbarAppearance = UIToolbar.appearance() // Set background color for default (standard) >toolbar toolbarAppearance.backgroundColor = UIColor.blue // Set background color for compact toolbar (e.g., landscapePhone) toolbarAppearance.setBackgroundImage(UIImage(named: "compactBackgroundImage"), for: .compact)
landscapePhone
UIBarMetrics
μ νλλ‘, νλ©΄μ΄ κ°λ‘ λ°©ν₯μΌλ‘ μ νλ κ²½μ°μ ν΄λΉνλ λ°μ ν¬κΈ°μ μμΉλ₯Ό λνλ- λλ°μ΄μ€κ° κ°λ‘ λͺ¨λ(
landscape mode
)λ‘ μ νλμμ λ μ μ©λλ λ°μ λ©νΈλ¦μ€// Using the appearance proxy to set different tint colors for different bar metrics let toolbarAppearance = UIToolbar.appearance() // Set tint color for default (standard) toolbar toolbarAppearance.tintColor = UIColor.red // Set tint color for compact toolbar in landscape mode toolbarAppearance.setTintColor(UIColor.green, for: .landscapePhone)
var standardAppearance: UIToolbarAppearance
: νμ€ λμ΄ ν΄λ°μ μ¬μ©ν μΈκ΄ μ€μ var compactAppearance: UIToolbarAppearance?
: μ½€ν©νΈ λμ΄ ν΄λ°μ μ¬μ©ν μΈκ΄ μ€μ var scrollEdgeAppearance: UIToolbarAppearance?
: μ€ν¬λ‘€ κ°λ₯ν μ½ν
μΈ μ κ°μ₯μλ¦¬κ° ν΄λ°μ κ°μ₯μ리μ μ λ ¬λ λ νμ€ λμ΄ ν΄λ°μ λν μΈκ΄ μ€μ var compactScrollEdgeAppearance: UIToolbarAppearance?
: μ€ν¬λ‘€ κ°λ₯ν μ½ν
μΈ μ κ°μ₯μλ¦¬κ° μ½€ν©νΈ λμ΄ ν΄λ°μ κ°μ₯μ리μ μ λ ¬λ λ μ½€ν©νΈ λμ΄ ν΄λ°μ λν μΈκ΄ μ€μ var isTranslucent: Bool
: ν΄λ°κ° λ°ν¬λͺ
νμ§ μ¬λΆλ₯Ό λνλ΄λ λΆμΈ κ°