300x250 iOS115 CustomView File's Owner 기준으로 작성하였습니다. file's owner = 말그대로 이 xib 파일의 주인을 말하며 이 파일에 구현되는 view는 file's owner의 클래스를 따르고, 분리되어 작성된다고 이해하면 됩니다. 화면을 분리하여 재사용성을 높이고 유연한 코드 유지 보수가 가능합니다. 준비 1. customView의 내용을 담을 .swift 파일 생성 2. customView UI를 만들 .xib 파일 생성 3. storyboard에 가져다 쓸 뷰이기 때문에 사이즈와 레이아웃에 제약을 받지 않기 위해 safeArea와 size 속성을 변경한다. File's Owner의 File inspector - Interface Builder Document의 'Use Safe Area Layout Gu.. 2022. 2. 23. ERROR 모음 Missing '@end'해결방법 .h / .m 파일에서 발생 오타가 없는지 찾는다. @end 가 있는지 체크 다른 파일에 @end가 빠져있는지 확인한다 unrecognized selector sent to instance Attempted to dereference an invalid ObjC Object or send it an unrecognized selector. must register a nib or a class for the identifier or connect a prototype cell in a storyboard" 아울렛이 잘 연결되어 있는지 확인 아울렛 또는 함수 명의 오류가 없는지 확인 아울렛 중복이 없는지 확인 별도 클래스가 연결되어 있는 객체가 있다면 클래스명을 지우고 다.. 2022. 2. 17. 타이머 @IBOutlet weak var authCountLb: UILabel! var timer: Timer? var time = 180 @IBAction func sendAuthNumTap(_ sender: UIButton) { authNumBtn.backgroundColor = UIColor(red: 43, green: 55, blue: 67, alpha: 1) time = 180 startTimer() } // 타이머 카운팅 @objc func scheduled() { if time < 0 { stopTimer() } let minutes = time / 60 let seconds = time % 60 authCountLb.text = String(format: "%02d : %02d초 남음", minu.. 2022. 1. 25. 아이폰 노치 여부 확인 방법 var safeAreaBottom:CGFloat = 0.0 if #available(iOS 15.0, *) { guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene else { return } safeAreaBottom = (windowScene.keyWindow?.safeAreaInsets.bottom)! } else { let keyWindow = UIApplication.shared.windows.first{$0.isKeyWindow} safeAreaBottom = (keyWindow?.safeAreaInsets.bottom)! } if safeAreaBottom > 0.0 { UserDefaults... 2022. 1. 24. navigation bar 숨김 시 swipe override func viewDidLoad() { super.viewDidLoad() navigationController?.interactivePopGestureRecognizer?.delegate = nil } 출처: https://greenchobo.tistory.com/13 2022. 1. 21. Dark mode 색상 적용 if #available(iOS 13, *) { view.backgroundColor = .systemBackground lb.textColor = .label } else { view.backgroundColor = .white lb.textColor = .black } 다크모드 막기 info.plist에서 Appearance추가하여 value에 Light 적어주기 2022. 1. 12. info.plist 화면 방향 Supported interface orientations (iPhone) 2022. 1. 12. 앱 아이콘 이미지 App Icon Generator appicon.co 여기에 접속해서 원하는 os를 선택하고 Generate 클릭 하기만 하면 이미지set 생성 완료 주의할점. 이미지 크기는 1024px 이상 정방향 png 확장자 불투명한 배경 Asset에 icon 추가하기. 다운로드된 파일을 보면 'AppIcon.appiconset'이라는 폴더가 있다. xcode Asset에서 기존의 AppIcon은 삭제하고 하단의 '+' - import - AppIcon.appiconset 이렇게 하면 프로젝트의 앱 아이콘이 사이즈 별로 들어가게 된다. 참고 : https://loganberry.tistory.com/17 2022. 1. 6. font가 nil일 때 별도의 폰트를 추가 후 적용했지만 nil로 들어오는 경우가 있다. 이유는 간혹 내가 보고 있는 폰트의 이름이 사실은 다를 수 있기 때문.. 이럴때는 폰트의 진짜 이름을 찾아서 적용 해주면 된다. Objective - C NSArray *familyNames = [UIFont familyNames]; for( NSString *familyName in familyNames ){ printf( "Family: %s \n", [familyName UTF8String] ); NSArray *fontNames = [UIFont fontNamesForFamilyName:familyName]; for( NSString *fontName in fontNames ){ printf( "\tFont: %s \n", [fon.. 2022. 1. 6. 이전 1 ··· 8 9 10 11 12 13 다음 300x250