본문 바로가기

ios83

[iOS] xib에서 Custom View 생성하는 방법 1. CustomView를 File's owner로 지정해서 쓰는 방법 CustomView 안에 contentView라고 하는 IBOutlet 뷰를 넣고 해당 뷰안에 원하는 화면을 구현하는 방법 장점 커스텀 뷰의 생성자 함수들을 온전히 사용할 수 있다. 단점 CustomView 안의 contentView라고 하는, 일종의 View Hierarchy에서 Super view 역할을 하는 뷰에 내용이 들어가있어서, subView를 추가할 때 CustomView가 아닌 CustomView.contentView에 추가해야 Hierarchy가 엉키지 않는다. CustomRedView import UIKit class CustomRedView: UIView { @IBOutlet weak var contentView:.. 2022. 7. 9.
[iOS] application(_:open:options:) 의 return 값은 어디서 사용되는가? Apple Developer Documentation developer.apple.com application(_:open:options:) delegate에게 URL로 이루어진 리소스를 열 것을 요청하고, 런치 옵션 dictionary를 제공한다. URL을 통해 application으로 진입할 때 호출된다. 만약 application(_:willFinishLaunchingWithOptions:) 와 application(_:didFinishLaunchingWithOptions:) 메서드 둘 다 false를 반환한다면 호출되지 않는다. 즉 하나라도 true를 반환한다면 호출된다. 만약 앱이 background 혹은 suspended 상태일 때 URL이 도착한다면, 시스템은 앱을 foreground로 옮.. 2022. 6. 25.
[iOS 예제] Ripple Effect Material Design Build beautiful, usable products faster. Material Design is an adaptable system—backed by open-source code—that helps teams build high quality digital experiences. material.io Ripple Effect 아래의 이미지와 같이 버튼이나 뷰를 클릭했을 때 마치 물결이 퍼지듯 원형 모향의 애니메이션이 퍼져나가면서 사용자에게 클릭을 인지시키는 효과 위의 구글 material에서 pod으로 다운받아 사용해도 된다. Code UIView을 상속받은 protocol을 만들어서, 최대한 재사용이 가능하게끔 만듬 원리는 아래와 같다. UIView의 touch.. 2022. 6. 19.
[iOS] 상황별 app life cycle 메서드 호출 순서 @main class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { window = UIWindow(frame: UIScreen.main.bounds) let vc = ViewController() let navVC = UINavigationController(rootViewController: vc) navVC.isNavigationBarHidden = true windo.. 2022. 6. 6.