아이폰 개발186 iOS Geofencing 예제 - 특정위치 안에 들어갔을때 알림(NSCoding, UserNotification) iOS Geofencing 예제 - 특정위치 안에 들어갔을때 알림(NSCoding, UserNotification) ✅ 구현 기능 1.알림을 받을 위치 지정하기(반경 + note 지정) 2.알림 받을 위치 어노테이션(마커) 표시하기 3.지도에서 어노테이션 클릭시 정보 표출 + 삭제가능 4.지정한 위치에 들어갔을때 or 벗어났을때 알림 기능 0.StoryBoard ✅ 유틸 클래스 구현 1. 커스텀 Alert 알림창 유틸 2. 지도 확대 유틸 Utilities.h #import @import UIKit; @import MapKit; @interface Utilities : NSObject //1.커스텀 알림창 띄우기 + (void)showSimpleAlertWithTitle:(NSString *)title .. 2021. 2. 15. iOS 배달앱 개발 예제(2) - (feat. 마커표시 MKAnnotation, CLLocationManagerDelegate, MKMapViewDelegate) iOS 배달앱 개발 예제(2) - (feat. 마커표시 MKAnnotation, CLLocationManagerDelegate, MKMapViewDelegate) ✅ 이번 포스팅에서 구현할 기능 1.특정 위치에 어노테이션(마크) 표시 2.어노테이션(마크) 클릭시 위치정보 표시 3.어노테이션 왼쪽에 이미지 넣기 4.어노테이션 오른쪽에 상세정보 버튼 넣기 5.상세정보 버튼 클릭시 alert 창 띄워주기 ✅ 어노테이션(마커) 클래스 생성 1.어노테이션(마커) 관련 변수 및 초기화 메소드 구현 Pin.h #import @import MapKit; //핀 객체 //마커(어노테이션)에 쓰일 객체. NS_ASSUME_NONNULL_BEGIN @interface Pin : NSObject //아래 변수 세개는 어노테이.. 2021. 2. 15. iOS 배달앱 개발 예제(1) - (feat. CoreLocation, NSTimer, NSURLSession) iOS 배달앱 개발 예제(1) - (feat. CoreLocation, NSTimer, NSURLSession) 목표 : CoreLocation, NSTimer, NSURLSession 을 이용해서 배달앱의 핵심 기능인 위치정보를 얻어서 서버로 전송하는 예제를 구현해본다. 1.근태화면에서 출근 버튼을 누르면 현재 위치가 3초 간격으로 서버에 전송된다. 2.출동화면에서 출동 버튼을 누르면 현재 위치가 3초 간격으로 서버에 전송된다. 3.CoreLocation 라이브러리를 이용해서 싱글톤 객체로 만들어서 현재 위치를 가져온다. 4.NSURLSession 은 delegate 패턴을 이용해서 Get 메소드 호출이 성공했을때나 실패했을때 , Delegate 메소드가 호출되게 한다. 화면 0.공통로직 CoreLoc.. 2021. 2. 9. iOS CoreLocation 공통 모듈 - 싱글톤 iOS CoreLocation 공통 모듈 - 싱글톤 1.CoreLocation 관련 라이브러리 추가 2.info.plist에 위치 동의관련 key value 값 입력 CoreLocation.h #import #import #import NS_ASSUME_NONNULL_BEGIN @interface CoreLocation : NSObject //CoreLocation 이 객체를 참조하는 카운터 @property (readwrite) NSInteger refNum; //로케이션 매니져 전역 변수 @property (nonatomic, retain) CLLocationManager *locationManager; //싱글톤 패턴 +(CoreLocation *) sharedSingleton; //지정 초기화 메.. 2021. 2. 9. iOS 최상위뷰 체크 예제 - Curent RootViewController iOS 최상위뷰 체크 예제 - Curent RootViewController 용어 정리 1.rootViewController : 앱 최초 생성시 존재하는 ViewController. (앱을 실행시켰을때 처음 실행되는 뷰 컨트롤러). 2.presentedViewController : 그 위에 올려져 있는 뷰 컨트롤러. applicationWillResignActive 메소드에서 현재 띄워진 뷰컨트롤러(rootViewController)를 파라미터로해서 visibleViewController 메소드의 인자로 넘긴다. visibleViewController 메소드 안에서는rootViewController.presentedViewController 를 isKindOfClass 메소드를 이용해서 네비게이션 컨트롤.. 2021. 2. 8. iOS 공통로그 & pch 파일 iOS 공통로그 & pch 파일 iOS 공통로그 & pch 파일 작성 예제 #ifndef MyPushTestPro_PrefixHeader_pch #define MyPushTestPro_PrefixHeader_pch // Include any system framework and library headers here that should be included in all compilation units. // You will also need to set the Prefix Header build setting of one or more of your targets to reference this file. //#ifdef DEBUG //#define NSLog( s, ... ) NSLog( @"[%@ %.. 2021. 2. 8. iOS UNNotificationServiceExtension 예제 Push Sound iOS UNNotificationServiceExtension 예제 Push Sound 이번 포스팅에서는 백그라운드 모드에서 푸시가 왔을때 소리를 출력 하거나, 푸시 메시지를 미리 가로채서 수정하는법, 또는 push에 image를 넣어서 보내기 기능등을 할 수 있는 방법에 대해서 알아본다. 먼저 일반적인 푸시 보내는 예제부터 알아보자. 일반적인 푸시 보내기 작성 순서는 아래와 같다. 1. 라이브러리 추가 Xcode builde phases 에서 두개의 라이브러리를 추가해준다. UserNotification framework, PushKit framework 2.라이브러리 import AppDelegate.h에서 1번에서 추가한 라이브러리를 import 해준다. 그리고 파이어 베이스 라이브러리도 impor.. 2021. 2. 5. iOS 화면보호기 예제 iOS 화면보호기 예제 1.화면을 손으로 터치하는지 감지하는 클래스 생성 DetectManager.h #import "ScreenSaverVC.h" #import NS_ASSUME_NONNULL_BEGIN //화면 터치 감지 체크 클래스(feat. 타이머) @interface DetectManager : NSObject //타이머 @property (strong,nonatomic) NSTimer *detectTimer; //싱글턴 패턴 +(DetectManager *)sharedObject; //화면 감지 체크를 위한 타이머 시작(재시작) -(void)resetDetectTimer; @end NS_ASSUME_NONNULL_END DetectManager.m 이 클래스의 객체를 생성할때, 딱 한번 싱글턴.. 2021. 2. 3. iOS UIActivityIndicatorView 예제 iOS UIActivityIndicatorView 예제 1.UIView를 상속한 로딩뷰 만들기 ActivityView.h 엑티비티인티게이터와 표시할 라벨을 변수로 설정해준다. #import NS_ASSUME_NONNULL_BEGIN @interface ActivityView : UIView //싱글턴 패턴 +(ActivityView *)sharedObject; @property (nonatomic, retain) UIActivityIndicatorView * activityView; @property (nonatomic, retain) UILabel *loadingLabel; @end NS_ASSUME_NONNULL_END ActivityView.m 변수로 설정한 인디케이터와 라벨을 초기화 해주고, 오토.. 2021. 2. 2. 이전 1 ··· 10 11 12 13 14 15 16 ··· 21 다음