繁体   English   中英

我正在尝试在UITableViewCell中显示json的响应,但无法正常工作

[英]I am trying to display response of json in UITableViewCell but not working

在此处输入图片说明

嗨,我正在尝试显示此图像中的响应,但未显示,并且发生了一些错误,因此请帮助我

-(void)getCategories
{
    Service *srv=[[Service alloc]init];

    NSString *str=@"http://streamtvbox.com/site/api/matrix/";//?country_code=91&phone=9173140993&fingerprint=2222222222";
    NSString *method=@"channels";
    NSMutableDictionary *dict=[[NSMutableDictionary alloc]init];

    [srv postToURL:str withMethod:method andParams:dict completion:^(BOOL success, NSDictionary *responseObj)
    {
        NSLog(@"%@",responseObj);
        arrayCategories = [responseObj valueForKey:@"categories"];
     }];
 }


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return arrayCategories.count;
}

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

{
    static NSString *simpleTableIdentifier = @"ChannelCell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];

    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
     }

     cell.textLabel.text = [[arrayCategories objectAtIndex:indexPath.row]valueForKey:@"categories"];

     return cell;
}

收到回复后,请重新加载,

 [srv postToURL:str withMethod:method andParams:dict completion:^(BOOL success, NSDictionary *responseObj)
    {
        NSLog(@"%@",responseObj);
        arrayCategories = [responseObj valueForKey:@"categories"];
    [youTableView reloadDate];
     }];

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM