POST

作者: 自知则知 | 来源:发表于2018-11-22 19:56 被阅读0次

    //POSt

    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];

    NSString *strURL = @"http://api.izhangchu.com";

    NSDictionary * dic = @{@"methodName": @"HomeSerial",  @"serial_id": @(1), @"size": @"20"};

    [managerPOST:strURLparameters:dicprogress:^(NSProgress*_NonnulluploadProgress) {

    }success:^(NSURLSessionDataTask*_Nonnulltask,id  _NullableresponseObject) {

        NSLog(@"%@",responseObject);

        [DataModelTwo mj_setupObjectClassInArray:^NSDictionary *{

            return@{

                @"data":@"DataModelThree"

            };

        }];

        self.dataModel= [DataModelmj_objectWithKeyValues:responseObject];

//        NSLog(@"dsds");

        [self.tableViewreloadData];

    }failure:^(NSURLSessionDataTask*_Nullabletask,NSError*_Nonnullerror) {

        NSLog(@"%@",error);

    }]

-(NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section{

    return self.dataModel.data.data.count;

}

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

    staticNSString*string =@"cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:string];

    if(!cell) {

        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:string];

    }

    DataModelThree*three =self.dataModel.data.data[indexPath.row];

    cell.textLabel.text= three.title;

    returncell;

}

#import "DataModelTwo.h"

NS_ASSUME_NONNULL_BEGIN

@interfaceDataModel :NSObject

@property (nonatomic , strong)DataModelTwo *data;

@end

相关文章

网友评论

      本文标题:POST

      本文链接:https://www.haomeiwen.com/subject/fqjrqqtx.html