1. 单一城市的天气预报代码怎么写越简单越好
//给你一个网址
//http://m.weather.com.cn/data/101010100.html
//http://blog.csdn.net/hello_haozi/article/details/7564223
NSString *shangHai = @"http://m.weather.com.cn/data/101020100.html";
NSOperationQueue *queue = [[NSOperationQueue alloc] init];
NSURL *url1 = [NSURL URLWithString:shangHai];
NSURLRequest *request1 = [[NSURLRequest alloc] initWithURL:url1];
[NSURLConnection sendAsynchronousRequest:request1 queue:queue completionHandler:^(NSURLResponse *response, NSData *da, NSError *error) {
if (da) {
NSDictionary *shangHaiDict = [NSJSONSerialization JSONObjectWithData:da options:NSJSONReadingMutableLeaves error:&error];
NSLog(@"%@",shangHaiDict);
}
}];
这是上海的天气 ,不知道是否回答了你的问题
2. 最好的网页天气预报代码(自动定制城市天气)
这是你想要的天气预报代码,由中央气象台提供数据,最准确最权威的天气预报,能够根据访客不同的IP地址显示不同城市的天气预报
下面是源程序代码:
<iframe src="http://www.ttyyy.com/tianqi/tq.html" width="160" height="60" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>