분류 전체보기

개발/아이오에스

swift]앱에서 디바이스 환경설정 - 해당 앱 알림 설정 창 화면에 띄우는 방법

UNUserNotificationCenter.current().getNotificationSettings { (settings) in guard settings.authorizationStatus == .authorized else{ let alert = UIAlertController(title: "알림", message: "기기 내 [설정]>[앱 이름]>[알림]에서\n알림을 허용해주세요.", preferredStyle: .alert) alert.addAction(UIAlertAction(title: "취소", style: .cancel, handler: nil)) alert.addAction(UIAlertAction(title: "확인", style: .default, handler: { _ in D..

개발/아이오에스

swift] 앱 최초 실행 시 push 설정 1회성 처리 UserDefaults

//앱 최초 실행 시 push 설정(푸쉬알림, 광고성 정보 수신동의 on) 1회성 func isFirstPush() -> (Bool) { let isBool = UserDefaults.standard.bool(forKey: UDataKey.InitPush) if !isBool { UserDefaults.standard.set(true, forKey: UDataKey.InitPush) } return isBool }

개발

swift] 업데이트시 마이그레이션을 위한 버전 체크

let savedVersion = UserDefaults.standard.value(forKey: "AppVersion") as? String ?? "0.0.0" if savedVersion.compare(version: "2.7.0") == .orderedAscending { //앞에 savedVersion가 뒤에 버전보다 작으면 여기 if문이 동작한다 } orderedAscending을 사용해서 2.7.3 < 2.7.10이 더 크다는 것을 체크할 수 있다.

개발/아이오에스

swift] UIView에 background에 image 파일 적용하기

let img = UIImage(named: "navi_bg") view.backgroundColor = UIColor(patternImage: img!)

개발

swift] SPM 만들기 - UIImage에 module의 image 선언하기

처음에는 이미지이터럴을 사용해서 선언해야겠다는 생각을 했지만 이미지이터럴은 해당 프로젝트의 번들에 있는 이미지를 참조하기 때문에 원하는 이미지를 불러 올 수 없었다. Package.swift에서 해당 타겟에 .target( name: "StudyPlan", dependencies:[], path: "StudyPlan/Sources", resources: [.process("Resources")] ) 으로 리소스를 선언해준다. 해당 리소스 폴더안에 Assets.xcassets을 넣어준다. listEditBtn.setImage(UIImage(named: "AlarmCal_btn_cal_delete", in: .module, compatibleWith: nil), for: .normal) 이 처럼 UIImag..

개발

swift] UIbutton의 UIimage 색상변경하기

https://stackoverflow.com/questions/27163171/change-color-of-png-in-buttons-ios Change color of png in buttons - ios I've got a set of icons that I've created that are transparent white PNGs: And what I'd like to do is be able to tint them to other colors. Such as blue, grey, etc. I've noticed that 'clicked/ta... stackoverflow.com btn.setImage(name: "testImage", for: .normal) btn.setImageTintCol..

dev.jake
'분류 전체보기' 카테고리의 글 목록 (7 Page)