小编Cli*_*iff的帖子

在UITableView中显示Json结果

我试图把我的JSON结果放在我的UITableView.我得到了JSON但我不能把它们放到我的桌面视图中.知道我做错了什么吗?

这是一些相关的代码:

- (void)viewDidLoad {
    TitlosArray = [[NSMutableArray alloc] init];
    KeimenoArray = [[NSMutableArray alloc] init];
    [super viewDidLoad];
    [self fetchTweets];
}
Run Code Online (Sandbox Code Playgroud)

我的JSON解析器工作正常:

- (void)fetchTweets {
    dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);

    dispatch_async(queue,  ^{
        NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://myselection.gr/support3/frontistiria_project/android_data.php/?type=publicNews"]];

        [self performSelectorOnMainThread:@selector(fetchedForecast:)withObject:data waitUntilDone:YES];
    });
}

- (void)fetchedForecast:(NSData *)responseData {
    NSError *error;
    NSDictionary *json = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&error];

    NSLog(@"Rows %@", [json objectForKey:@"total_rows"]);
    NSArray *items = [json valueForKeyPath:@"content"];

    NSEnumerator *enumerator = [items objectEnumerator];
    titlosjson.text=[[items objectAtIndex:1] objectForKey:@"title"]; …
Run Code Online (Sandbox Code Playgroud)

json objective-c uitableview ios

0
推荐指数
1
解决办法
1678
查看次数

标签 统计

ios ×1

json ×1

objective-c ×1

uitableview ×1