iOS_21團購_發送請求擷取【點評】資料,ios_21團購
請求結果簡單顯示:
用到的點評封裝的類:
使用tableView簡單展示:
//// DealListController.m// 帥哥_團購//// Created by beyond on 14-8-14.// Copyright (c) 2014年 com.beyond. All rights reserved.// 點擊dock上面的【團購】按鈕對應的控制器,上面是導覽列,導覽列右邊是searchBar,導覽列左邊是一個大按鈕(TopMenu)(內部由三個小按鈕組成<TopMenuItem>)#import "DealListController.h"// 導覽列左邊是一個大按鈕(頂部菜單)#import "TopMenu.h"#import "DPAPI.h"#import "MetaDataTool.h"// 資料模型,對應伺服器返回的一個團購字典#import "Deal.h"// 資料模型,裡面有一個數組,存放所有商區(District)對象#import "City.h"@interface DealListController ()<DPRequestDelegate>{ // 用於儲存伺服器返回的所有deals字典,並轉成一個個deal對象 NSMutableArray *_deals;}@end@implementation DealListController- (void)viewDidLoad{ [super viewDidLoad]; // 1,設定上方的導覽列,右邊是搜尋bar,左邊是一個大的VIEW(內有三個按鈕) [self addNaviBarBtn]; _deals = [NSMutableArray array]; }// 1,設定上方的導覽列,右邊是搜尋bar,左邊是一個大的VIEW(內有三個按鈕)- (void)addNaviBarBtn{ // 1.監聽城市改變的通知 kAddAllNotes(dataChange) // 2.右邊的搜尋方塊 UISearchBar *s = [[UISearchBar alloc] init]; s.frame = CGRectMake(0, 0, 210, 35); s.placeholder = @"請輸入商品名、地址等"; self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:s]; // 3.左邊的功能表列,導覽列左邊是一個大按鈕(頂部菜單) TopMenu *topMenu = [[TopMenu alloc] init]; // 4.用於點擊頂部按鈕時,容納建立出來的底部快顯功能表(包括一個contentView和cover,contentView又包括scrollView和subTitleImgView),本成員是由建立此TopMenu的外部賦值傳入, 這裡是控制器的view,就是導覽列下面的所有地區 topMenu.controllerView = self.view; self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:topMenu];}// temp -- test- (void)dataChange{ DPAPI *dpapi = [[DPAPI alloc]init]; [dpapi requestWithURL:@"v1/deal/find_deals" params:@{@"city": [MetaDataTool sharedMetaDataTool].currentCity.name} delegate:self];}// temp -- test- (void)request:(DPRequest *)request didFinishLoadingWithResult:(id)result{ [_deals removeAllObjects]; NSArray *arr = result[@"deals"]; for (NSDictionary *dict in arr) { Deal *deal = [[Deal alloc]init]; [deal setValuesWithDict:dict]; [_deals addObject:deal]; } // 接下來就可以給tableView提供資料來源了 [self.tableView reloadData];}- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return _deals.count;}- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *cellID = @"Beyond"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; if (cell == nil) { cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellID]; } // 設定cell中獨一無二的內容 Deal *deal = [_deals objectAtIndex:indexPath.row]; cell.textLabel.text = deal.title; cell.detailTextLabel.text = deal.desc; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; // 返回cell return cell;}@end
怎擷取福士點評團購券
直接買啊,這類團購券都是電子券形式的
福士點評團購券發送不成功為何
估計是手機號碼錯誤唄或者出什麼問題了,你重新拿一下就好了。