IOS 大众点评 团购界面实现

具体实现功能与首页界面的功能相近,比其简单。

 

1.仍然需要在API接口代码中  添加解析方法

NSMutableArray*groupArr = [NSMutableArray array];

    groupArr  = [JsonParser  jsonParserGroupBuyByDic:dic];

 

实现顺序: 1.创建模型,模型声明属性;

2.创建解析类,实现方法:(没有得到 API地址,没有得到Json之前不用实现具体代码 只需要一个方法名,有返回数组);

3.API接口代码中  调用解析方法,声明数组,返回数组,

4.在团购主页面即viewController中调用第二个解析API接口方法:传递进去可变数组的判定; 声明当前页面的数据源数组接收 这个API接口方法返回的数组

[self.dic setObject:@"北京" forKey:@"city"];

    self.groups = [DianpingApi requestDealsWithParams:self.dic]; 字典用之前要初始化。

5.得到数据源数组,就可以进行进一步操作了。 哈哈哈

6.自定义Cell 创建出来,  在自定义Cell界面关联控件, 声明对象来接收viewController中页面当前点击的Cell传递出去的

 

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

    GroupBuyTableViewCell *cell = [[NSBundle mainBundle]loadNibNamed:@"GroupBuyTableViewCell" owner:self options:nil].lastObject;

    if (!cell) {

        cell = [[GroupBuyTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];

    

    }

    cell.group = self.groups[indexPath.row];  6中描述的就是这个

    return cell;

}

 

7.就是跳转界面,这个最简单了 在didselect中 创建一个全屏的WebView将当前点击的行 对应传递跳转

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath{

    UIViewController *vc = [[UIViewController alloc]init];

    UIWebView *wv = [[UIWebView alloc]initWithFrame:vc.view.bounds];

    

    [vc.view addSubview:wv];

    self.g = self.groups[indexPath.row];

    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:self.g.deal_url]];

    [wv loadRequest:request];

    

    [self.navigationController pushViewController:vc animated:YES];

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值