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>