[iOS 강좌] 오픈API 이용한 날씨 APP 만들기 - 6. 모델 객체

날씨 API 호출된 모델 객체를 생성합니다. {             "dt": 1532314800,             "main": {                 "temp": 308.77,                 "temp_min": 305.287,                 "temp_max": 308.77,                 "pressure": 1002.18,                 "sea_level": 1023.05,                 "grnd_level": 1002.18,                 "humidity": 67,                 "temp_kf": 3.48             },             "weather": [                 {                     "id": 801,                     "main": "Clouds",                     "description": "few clouds",                     "icon": "02d"                 }             ],             "clouds": {                 "all": 20             },             "wind": {                 "speed": 1.47,                 "deg&quo

[iOS 강좌] 오픈API 이용한 날씨 APP 만들기 - 7. CoreLocation

내위치를 기반으로 날씨 정보를 가져올수 있습니다. // 코어 로케이션 #import < CoreLocation / CoreLocation.h > // 변수 @property ( nonatomic , strong ) CLLocationManager * locationManager ; // Location Manager 생성 self . locationManager = [[ CLLocationManager alloc ] init ];      // Location Receiver 콜백에 대한 delegate 설정 self . locationManager . delegate = self ; // 델리게이트 < CLLocationManagerDelegate > // longitude, latitude 값 가져옴 - ( void ) locationManager :( CLLocationManager *)manager didUpdateLocations :( NSArray *)locations{    CLLocation * currentLocation = [locations lastObject ];     currentLocation. coordinate . longitude     currentLocation. coordinate . latitude } 사용권한을 확인 후 코어 로케이션을 시작합니다.   // 사용권한 확인 , 사용권한이 켜있을 경우 코어 로케이션 START CLAuthorizationStatus status = [ CLLocationManager authorizationStatus ];     if (status == kCLAuthorizationStatusAuthorizedWhenInUse || status == kCLAuthorizationStatusDenied ) {           

[iOS 강좌] 오픈API 이용한 날씨 APP 만들기 - 4. open API

날씨 API를 이용하기 위해, 아래의 사이트에서 회원가입 후 key를 발급 받습니다. • https://openweathermap.org/ • 날씨 오픈 API . 회원가입 후 API   Key 발급 ( 무료 ) 여러 API 중 5일 3시간 단위의 API를 사용합니다. 도시명과, APP ID, 발급받은 Key로 API를 호출합니다. • API > 5 day / 3 hour forecast > API DOC • 도시명으로 날씨 검색 (3 시간 단위 , 5 일치 )   api.openweathermap.org /data/2.5/ forecast? id =524901&APPID= 발급받은 API Key 호출방법은 AFKNetwork 오픈소스를 이용 하여, get 방식으로 간단하게 호출할수 있습니다. NSDictionary * parameters = @{                          @"id" : @"1835848" ,                          @"APPID" : @"f18379cb9ed5dff3d62ad51bab87ba8a" ,                          } ; [ self reqWeatherApi : @"https:// api.openweathermap.org /data/2.5/forecast?" parameters :dic ]; -( void ) reqWeatherApi :( NSString *) url parameters:( NSDictionary *)parameters{     AFHTTPSessionManager *manager = [ AFHTTPSessionManager manager ];     [manager GET :url parameters :parameters

[iOS 강좌] 오픈API 이용한 날씨 APP 만들기 - 3. UIkit Framework

UIScrollView // 객체 생성 및 초기화 UIScrollView * scrollView = [[ UIScrollView alloc ] init ]; // 프레임 설정 [ scrollView setFrame : CGRectMake ( 0 , 0 , 0 , 0 ,)]; // 백그라운드 컬러 설정 [ scrollView setBackgroundColor :[ UIColor orangeColor ]]; // 컨텐츠 크기 설정 [ scrollView setContentSize : CGSizeMake ( 0 , 0 )]; // 인디케이트 설정 scrollView. showsVerticalScrollIndicator = YES ; // 델리게이트 설정 scrollView. delegate = self ; // 뷰에 추가 [ self . view addSubview :scrollView ]; < UIScrollViewDelegate > // 스크롤 위치 델리케이트 - ( void ) scrollViewDidScroll :( UIScrollView *) scrollView ;   UIView // 객체 생성 및 초기화 UIView * subView = [[ UIView alloc ] init ]; // 프레임 설정 [ subView setFrame : CGRectMake ( 0 , 0 , 0 , 0 )]; // 백그라운드 설정 [ subView setBackgroundColor :[ UIColor redColor ]]; // 레이어 윤곽 [ subView. layer setBorderWidth : 1 ]; // 레이어 윤곽 색상 [ subView. layer setBorderColor :[ UIColor blueColor ]. CGColor ]; // 레이어 모서리