//
// AppDelegate.m
// Objective-C Fianl Test
//
// Created by user on 19/11/24.
// Copyright © 2019年 user. All rights reserved.
//
#import "AppDelegate.h"
@interface AppDelegate ()
/** 城市编码输入框 */
@property (weak) IBOutlet NSTextField *cityCodeTextField;
/** 状态文本框 */
@property (weak) IBOutlet NSTextField *statusLabel;
/** 城市名称文本框 */
@property (weak) IBOutlet NSTextField *cityNameLabel;
/** 省份名称文本框 */
@property (weak) IBOutlet NSTextField *provinceNameLabel;
/** 更新时间文本框 */
@property (weak) IBOutlet NSTextField *updateTimeLabel;
/** 湿度显示文本框 */
@property (weak) IBOutlet NSTextField *humidityLabel;
/** 温度显示文本框 */
@property (weak) IBOutlet NSTextField *temperatureLabel;
/** 空气质量显示文本框 */
@property (weak) IBOutlet NSTextField *qualityLabel;
/** pm2.5显示文本框 */
@property (weak) IBOutlet NSTextField *pm25Label;
/** pm10显示文本框 */
@property (weak) IBOutlet NSTextField *pm10Label;
/** 预报显示文本框 */
@property (unsafe_unretained) IBOutlet NSTextView *forecastTextView;
/** 搜索结果显示文本框 */
@property (unsafe_unretained) IBOutlet NSTextView *searchResultTextView;
@property (weak) IBOutlet NSWindow *window;
@end
@implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
/*
城市编码查询 https://where.heweather.com/location.html
API地址 http://t.weather.sojson.com/api/weather/city/城市编码
直接输入城市名查询城市天气:
(需要注册账号,详见文档https://dev.heweather.com/docs/search/find )
界面中把城市编码输入框修改为 城市名字输入框
输入城市名称后,查询 先通过搜索城市编码,得到结果后 拿到城市编码
再通过城市编码 通过 天气查询的API 进行具体的天气查询
*/
}
#pragma mark 天气查询事件
- (IBAction)checkCityWeatherAction:(id)sender {
NSLog(@"点击了天气查询 当前查询的城市编码:%@",self.cityCodeTextField.stringValue);
}
- (IBAction)theMostHotDayAction:(id)sender {
NSLog(@"点击了预报中最热的一天");
}
- (IBAction)theMostColdDayAction:(id)sender {
NSLog(@"点击了预报中最冷的一天");
}
- (IBAction)sunriseDayAction:(id)sender {
NSLog(@"点击了预报中日出最早的一天");
}
- (IBAction)northWindDayAction:(id)sender {
NSLog(@"点击了预报中北风的日子");
}
- (IBAction)fineDayAction:(id)sender {
NSLog(@"点击了预报中晴天的日子");
}
- (void)applicationWillTerminate:(NSNotification *)aNotification {
// Insert code here to tear down your application
}
@end
// AppDelegate.m
// Objective-C Fianl Test
//
// Created by user on 19/11/24.
// Copyright © 2019年 user. All rights reserved.
//
#import "AppDelegate.h"
@interface AppDelegate ()
/** 城市编码输入框 */
@property (weak) IBOutlet NSTextField *cityCodeTextField;
/** 状态文本框 */
@property (weak) IBOutlet NSTextField *statusLabel;
/** 城市名称文本框 */
@property (weak) IBOutlet NSTextField *cityNameLabel;
/** 省份名称文本框 */
@property (weak) IBOutlet NSTextField *provinceNameLabel;
/** 更新时间文本框 */
@property (weak) IBOutlet NSTextField *updateTimeLabel;
/** 湿度显示文本框 */
@property (weak) IBOutlet NSTextField *humidityLabel;
/** 温度显示文本框 */
@property (weak) IBOutlet NSTextField *temperatureLabel;
/** 空气质量显示文本框 */
@property (weak) IBOutlet NSTextField *qualityLabel;
/** pm2.5显示文本框 */
@property (weak) IBOutlet NSTextField *pm25Label;
/** pm10显示文本框 */
@property (weak) IBOutlet NSTextField *pm10Label;
/** 预报显示文本框 */
@property (unsafe_unretained) IBOutlet NSTextView *forecastTextView;
/** 搜索结果显示文本框 */
@property (unsafe_unretained) IBOutlet NSTextView *searchResultTextView;
@property (weak) IBOutlet NSWindow *window;
@end
@implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
/*
城市编码查询 https://where.heweather.com/location.html
API地址 http://t.weather.sojson.com/api/weather/city/城市编码
直接输入城市名查询城市天气:
(需要注册账号,详见文档https://dev.heweather.com/docs/search/find )
界面中把城市编码输入框修改为 城市名字输入框
输入城市名称后,查询 先通过搜索城市编码,得到结果后 拿到城市编码
再通过城市编码 通过 天气查询的API 进行具体的天气查询
*/
}
#pragma mark 天气查询事件
- (IBAction)checkCityWeatherAction:(id)sender {
NSLog(@"点击了天气查询 当前查询的城市编码:%@",self.cityCodeTextField.stringValue);
}
- (IBAction)theMostHotDayAction:(id)sender {
NSLog(@"点击了预报中最热的一天");
}
- (IBAction)theMostColdDayAction:(id)sender {
NSLog(@"点击了预报中最冷的一天");
}
- (IBAction)sunriseDayAction:(id)sender {
NSLog(@"点击了预报中日出最早的一天");
}
- (IBAction)northWindDayAction:(id)sender {
NSLog(@"点击了预报中北风的日子");
}
- (IBAction)fineDayAction:(id)sender {
NSLog(@"点击了预报中晴天的日子");
}
- (void)applicationWillTerminate:(NSNotification *)aNotification {
// Insert code here to tear down your application
}
@end