일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
- 리펙터링
- 클린 코드
- 리펙토링
- Xcode
- 리팩토링
- SWIFT
- 스위프트
- Human interface guide
- UICollectionView
- 애니메이션
- ios
- UITextView
- MVVM
- Protocol
- collectionview
- uiscrollview
- clean architecture
- RxCocoa
- rxswift
- combine
- swift documentation
- Refactoring
- HIG
- swiftUI
- tableView
- Observable
- uitableview
- ribs
- map
- Clean Code
- Today
- Total
목록UIButton (7)
김종권의 iOS 앱 개발 알아가기
UIButton 상태 애니메이션 처리 방법 보통 UIButton의 highlighted 상태를 표시할 때 아래처럼 작성 버튼의 isSelected 상태에 따라 highlighted 색상을 매번 설정하고 있는 상태 private let button: UIButton = { let button = UIButton() button.setTitle("버튼", for: .normal) button.setTitle("선택됨", for: .selected) button.setTitleColor(.blue, for: .normal) button.setTitleColor(.systemBlue, for: .highlighted) button.setTitleColor(.red, for: .selected) button.tr..
UIButton의 imageView, titleLabel UIButton에는 내부적으로 UIImageView와 UILabel이 존재 아래처럼 UIButton하나만 사용하면 버튼안에 이미지와 텍스트 삽입이 가능 import UIKit class ViewController: UIViewController { private let button: UIButton = { let button = UIButton() button.setTitle("button", for: .normal) button.setTitleColor(.systemBlue, for: .normal) button.setTitleColor(.blue, for: .highlighted) button.addTarget(self, action: #sel..
일반적인 UIButton의 action 처리 방법 UIButton의 인스턴스 메소드인 addTarge(_:action:for:)를 사용하여 처리 단점은 button의 addTarget하는 부분에서 특정 지역변수에 대한 기능을 touchUpInside 액션 시 동작하게 하기 어려운 점이 존재 아래 abc 지역 프로퍼티를 button의 touchUpInside될 때 출력하고 싶어도 어려운 상태 button의 클로저로 만들면? (아래에서 계속) class ViewController: UIViewController { private let button = UIButton() override func viewDidLoad() { super.viewDidLoad() let abc = 123 button.transl..
isHighlighted 버튼을 눌렀을 때, isHighlighted = true로 변경되었다가, isHighlighted = false로 다시 변경 * isHighlighted 상태 확인 방법 - UIButton의 isHighlighted 프로퍼티를 override하여 didSet으로 확인 public protocol AnimationButtonDelegate: AnyObject { func didChangeHighlighted(highlighted: Bool) } class AnimationButton: UIButton { weak var delegate: AnimationButtonDelegate? override var isHighlighted: Bool { didSet { self.delegat..
NSMutableAttributedString 텍스트 + 속성값을 가지고 있는 인스턴스 속성값: 텍스트 색상, 폰트, 하이퍼링크 등 속성 값을 가지고 있는 String 인스턴스 사용 방법 NSMutableAttributedString 인스턴스를 만든 후, 해당 인스턴스에 underlineStyle 속성을 추가하고, UIButton.setAttributedTitle()로 만든 인스턴스 주입 extension UIButton으로 구현 extension UIButton { // 구현 } UIButton의 title 획득 guard let title = title(for: .normal) else { return } NSMutableAttributedString 인스턴스 획득 let attributedStrin..
목표 baseButton을 하나 만들고, 공통적으로 baseButton의 속성을 가지면서 각자의 특색있는 커스텀 버튼 생성 BaseButton 생성 cornerRadius가 4인 Base버튼 클래스 생성 // // MyBaseButton.swift // Test // // Created by 김종권 on 2020/11/20. // import Foundation import UIKit class MyBaseButton: UIButton { override init(frame: CGRect) { super.init(frame: frame) setupView() } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) setupView(..