參數(shù)

-(void)getData{
    //    //cityId:城市ID
    //    //lat:緯度
    //    //lng:經(jīng)度
    //showType
    //sendPrice
    //defaultOeder
    NSMutableDictionary *dic = [[NSMutableDictionary alloc] init];
    NSDictionary *userInfo = [[NSUserDefaults standardUserDefaults] objectForKey:@"UserInfo"];
    [dic setValue:userInfo[@"supermaketName"] forKey:@"supermaketName"];
    [dic setValue:userInfo[@"tasteCategory"] forKey:@"tasteCategory"];
    [dic setValue:@"0411" forKey:@"ctiyId"];
    [dic setValue:[NSNumber numberWithDouble:121.517977] forKey:@"lng"];
    [dic setValue:[NSNumber numberWithDouble:38.8496481] forKey:@"lat"];
    [dic setValue:userInfo[@"type"] forKey:@"type"];
    [dic setValue:@"1" forKey:@"showType"];
    [MBProgressHUD showHUDAddedTo:self.view animated:YES];// 提示用戶正在請(qǐng)求
    [[SetRequest sharedInstance]postRequestWithURL:URL(searchSupermarketList)
    postParems:dic content:^(NetWorkModel *model){
        
        [MBProgressHUD hideAllHUDsForView:self.view animated:YES];
        if(model.error){
            
            NSLog(@"獲取列表失敗");
        }else{
            
            if ([model.responseDic[@"error_code"] intValue] == 0) {
                
                
                _dataSource = model.responseDic[@"restaurantList"];
                
                [_tableView reloadData];
                
            }
        }
    }];
}
  • 有參數(shù) 有URL
  • 參數(shù)是
    //cityId:城市ID
    //lat:緯度
    //lng:經(jīng)度
    //showType
    //sendPrice
    //defaultOeder
  • 打印model.responseDic為
dishesList =     (
                {
            classificationId = 10001;
            classificationName = "進(jìn)口食品";
            dishName = "蒙牛純牛奶1L";
            dishesState = 0;
            id = 1011611107;
            isPackages = 0;
            measureUnit = 9;
            name = "蒙牛純牛奶1L";
            practiceSortId = 0;
            price = 8;
            recommendFlag = 0;
            smallImgPath = "http://dalianmohekeji.eicp.net:8102/repastmanage/upload/2015/08/19/16/50/20/small1916502378468.jpg";
            tasteSortId = 0;
            total = 0;
            vipPrice = 8;
  };
}
  • URL 是利用拼接的方法

  • 一個(gè)宏拼接另一個(gè)宏

  • 把所有的數(shù)據(jù)放到字典里

  • dic = model.responseDic[@"UserInfo"];

  • 在頁(yè)面中顯示就取dic里面的值

 _TextFieldOne.text = _dic[@"clUserName"];
 _TextFieldTwo.text = _dic[@"telephone"];
 _TextFieldThree.text = _dic[@"address"];
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容