星空网 > 软件开发 > 操作系统

简单天气应用开发——自定义TableView

  顺利解析JSON数据后,天气数据已经可以随意提取了,现在要做的就是建立一个简单的UI。

  实况信息较为简单,几个Lable就可以解决。主要是七天天气预报有点麻烦,那是一个由七个字典构成的数组,需要提取出每一天的数据,再组合之后显示在屏幕上。

  考虑到简便性,决定使用TableView加上自定义Cell。

  新建dailyCell类,同时建立同名xib文件,拖一个Cell,加上三个Lable

简单天气应用开发——自定义TableViewimages/loading.gif' data-original="http://images2015.cnblogs.com/blog/803342/201602/803342-20160211151545777-1742405732.png" />

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{
NSInteger row = [indexPath row];
static NSString *ID = @"Cell";
dailyCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
if (cell == nil) {
cell = [[[NSBundle mainBundle] loadNibNamed:@"dailyCell" owner:nil options:nil]lastObject];

}
tableView.separatorStyle = UITableViewCellSelectionStyleNone; //无边框
tableView.scrollEnabled = NO; //不可滚动
cell.selectionStyle = UITableViewCellSelectionStyleNone; //不可选中

cell.dateLable.text = self.data.dateArray[row];
cell.condLable.text = self.data.condArray[row];
cell.tmpLable.text = self.data.tmpArray[row];
return cell;

}

  用自定义Cell替换掉默认样式,七天天气预报的显示就此完成。

 




原标题:简单天气应用开发——自定义TableView

关键词:ie

ie
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

Wayfair店铺申请:https://www.goluckyvip.com/tag/27159.html
德国税务法案:https://www.goluckyvip.com/tag/2716.html
Wayfair订单:https://www.goluckyvip.com/tag/27160.html
wayfair海外仓:https://www.goluckyvip.com/tag/27161.html
Wayfair开店:https://www.goluckyvip.com/tag/27162.html
Wayfair开店费用:https://www.goluckyvip.com/tag/27163.html
跨境支付百科——巴西支付篇:https://www.kjdsnews.com/a/1836648.html
大福地快捷酒店预订 大福酒店怎么走:https://www.vstour.cn/a/365187.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流