ios_21 Buy _ Send Request "Reviews" data

Source: Internet
Author: User

The result shows that a simple request:


Reviews encapsulated classes:







Simple display using TableView:

deallistcontroller.m//Handsome _ buy////Created by Beyond on 14-8-14.//Copyright (c) 2014 Com.beyond. All rights reserved.//Click on the dock above the "group buy" button corresponding controller, above the navigation bar, the right side of the navigation bar is Searchbar, the left side of the navigation bar is a large button (Topmenu) (the interior consists of three small buttons <TopMenuItem>) #import "DealListController.h"//navigation bar to the left is a large button (top menu) #import "TopMenu.h" #import "DPAPI.h" # Import "MetaDataTool.h"//data model, the corresponding server returned a buy dictionary #import "Deal.h"//data model, there is an array, storing all the quotient area (District) object #import "City.h" @ Interface Deallistcontroller () <dprequestdelegate>{//For saving all deals dictionaries returned by the server and turning them into deal objects Nsmutablearray *_de als;}    @end @implementation deallistcontroller-(void) viewdidload{[Super Viewdidload];    1, set the upper navigation bar, the right is the search bar, the left is a large view (there are three buttons) [self addnavibarbtn];        _deals = [Nsmutablearray array];        }//1, set the upper navigation bar, the right is the search bar, the left side is a large view (three buttons inside)-(void) addnavibarbtn{//1. Notice of City Change Kaddallnotes (DataChange)    2. The search box on the right Uisearchbar *s = [[Uisearchbar alloc] init];    S.frame = CGRectMake (0, 0, 210, 35); S.placeholder = @ "Please enter product name, address, etc.";        Self.navigationItem.rightBarButtonItem = [[Uibarbuttonitem alloc] initwithcustomview:s];    3. On the left side of the menu bar, the left side of the navigation bar is a large button (top menu) Topmenu *topmenu = [[Topmenu alloc] init]; 4. For clicking on the top button, hold the created bottom pop-up menu (including a contentview and Cover,contentview with ScrollView and Subtitleimgview),        This member is passed in by the external assignment that created this topmenu, which is the controller view, which is the entire area below the navigation bar 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]; }//Next you will be able to provide a data source for 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]   ;   }//Set unique content in cell Deal *deal = [_deals objectAtIndex:indexPath.row];   Cell.textLabel.text = Deal.title;   Cell.detailTextLabel.text = Deal.desc;   Cell.accessorytype = Uitableviewcellaccessorydisclosureindicator; returns cell return cell; @end


Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.

ios_21 Buy _ Send Request "Reviews" data

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.