UITableView 分页显示,数据源远程数据,使用JSON格式 [xcode 4.4.1]
<div id="cnblogs_post_body">在这篇里,我们要学习的目标:[*]1. 解析远程的JSON数据
[*]2. 分页显示数据
[*]3. 学习Category的使用
概述
<blockquote> IOS5.0开始支持JSON,所以不用第三方的解析了,主要用于这三个对象:NSDictionary、NSData、NSJSONSerializatio
今天我们做一个天气预报数据的展示,通过国家气象局提供的天气预报接口来获取数据。注:以实现功能为主,不做过多的界面上展示
接口地址:
[*]http://www.weather.com.cn/data/sk/101010100.html
[*]http://www.weather.com.cn/data/cityinfo/101010100.html
[*]http://m.weather.com.cn/data/101010100.html
以第三个地址显示内容最全,我们就以这个地获取数据,返回的数据格式如下:
<div class="cnblogs_code" >http://images.cnblogs.com/OutliningIndicators/ContractedBlock.gifhttp://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gifView Code <div id="cnblogs_code_open_7fbcaa60-ca8c-4cf6-b19c-9d32f996306b" class="cnblogs_code_hide"> 1 {
2 "weatherinfo":{
3 "city":"北京",
4 "city_en":"beijing",
5 "date_y":"2012年9月5日",
6 "date":"",
7 "week":"星期三",
8 "fchh":"11",
9 "cityid":"101010100",
10 "temp1":"27℃~17℃",
11 "temp2":"24℃~17℃",
12 "temp3":"25℃~17℃",
13 "temp4":"27℃~16℃",
14 "temp5":"28℃~17℃",
15 "temp6":"26℃~17℃",
16 "tempF1":"80.6℉~62.6℉",
17 "tempF2":"75.2℉~62.6℉",
18 "tempF3":"77℉~62.6℉",
19 "tempF4":"80.6℉~60.8℉",
20 "tempF5":"82.4℉~62.6℉",
21 "tempF6":"78.8℉~62.6℉",
22 "weather1":"晴转阴",
23 "weather2":"阵雨",
24 "weather3":"阵雨转多云",
25 "weather4":"多云转晴",
26 "weather5":"晴",
27 "weather6":"多云转阵雨",
28 "img1":"0",
29 "img2":"2",
30 "img3":"3",
31 "img4":"99",
32 "img5":"3",
33 "img6":"1",
34 "img7":"1",
35 "img8":"0",
36 "img9":"0",
37 "img10":"99",
38 "img11":"1",
39 "img12":"3",
40 "img_single":"0",
41 "img_title1":"晴",
42 "img_title2":"阴",
43 "img_title3":"阵雨",
44 "img_title4":"阵雨",
45 "img_title5":"阵雨",
46 "img_title6":"多云",
47 "img_title7":"多云",
48 "img_title8":"晴",
49 "img_title9":"晴",
50 "img_title10":"晴",
51 "img_title11":"多云",
52 "img_title12":"阵雨",
53 "img_title_single":"晴",
54 "wind1":"微风",
55 "wind2":"微风",
56 "wind3":"微风",
57 "wind4":"微风",
58 "wind5":"微风",
59 "wind6":"微风",
60 "fx1":"微风",
61 "fx2":"微风",
62 "fl1":"小于3级",
63 "fl2":"小于3级",
64 "fl3":"小于3级",
65 "fl4":"小于3级",
66 "fl5":"小于3级",
67 "fl6":"小于3级",
68 "index":"暖",
69 "index_d":"较凉爽,建议着长袖衬裤等春秋过渡装。体弱者宜着长袖衬衫和马甲。但昼夜温差较大,请适当增减衣服。",
70 "index48":"暖",
71 "index48_d":"较凉爽,建议着长袖衬衫加单裤等春秋过渡装。年老体弱者宜着针织长袖衬衫、马甲和长裤。",
72 "index_uv":"中等",
73 "index48_uv":"弱",
74 "index_xc":"不宜",
75 "index_tr":"适宜",
76 "index_co":"较舒适",
77 "st1":"26",
78 "st2":"17",
79 "st3":"22",
80 "st4":"16",
81 "st5":"23",
82 "st6":"17",
83 "index_cl":"适宜",
84 "index_ls":"适宜",
85 "index_ag":"易发"
86 }
87 }
页:
[1]