- (void)viewDidLoad
{
[super viewDidLoad];
NSURL *url=[NSURL URLWithString:@"http://api.geonames.org/citiesJSON?north=44.1&south=-9.9&east=-22.4&west=55.2&lang=de&username=demo"];
NSURLRequest *request=[[NSURLRequest alloc]initWithURL:url];
[[NSURLConnection alloc]initWithRequest:request delegate:self];
-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response{
_data=[[NSMutableData alloc]init];
}
-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)thedata{
[_data appendData:thedata];
-(void)connectionDidFinshLoading:(NSURLConnection *)connection{
_name=[NSJSONSerialization JSONObjectWithData:_data options:NSJSONReadingMutableContainers error:nil];
[self.tableView reloadData];
0
A
回答
0
{ “GEONAMES”:[{ “LNG”: - 99.12766456604, “geonameId”:3530597, “COUNTRYCODE”: “MX”, “名称”:“Mexiko -Stadt“, ”fclName“:”city,village,...“, ”toponymName“:”Mexico City“, ”fcodeName“:”政治实体的资本“, ”wikipedia“:”en。 wikipedia.org/wiki/Mexico_City”, “LAT”:19.428472427036, “FCL”: “P”, “种群”:12294193, “FCODE”: “PPLC” },{ “LNG”:116.397228240967 , “geonameId”:1816670, “COUNTRYCODE”: “CN”, “名”: “北平”, “fclName”: “城市,村庄,...”, “toponymName”: “北京”, “fcodeName”:“政治实体的首都”, “维基百科”:“en.wikipedia.org/wiki/Beijing”, “lat”:39.9074977414405, “fcl”:“P”,“population”:11716620 , “FCODE”: “PPLC” }]}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return [self.name count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell =
[tableView dequeueReusableCellWithIdentifier:@"Cell"
forIndexPath:indexPath];
// Configure the cell...
cell.textLabel.text=[[self.nameobjectAtIndex:indexPath.row]objectForKey:@"geonameId"];
return cell;
}
其没有显示任何错误消息.....其运行......和表示空表视图.....
相关问题
- 1. 将Json数据加载到TableView中
- 2. 未在jqgrid中加载json数据
- 3. 在XML解析完成之前加载tableview,未加载数据
- 4. tableView不加载数据
- 5. 加载数据到TableView
- 6. jQuery Flot图形未加载(JSON数据)
- 7. 未使用jQuery加载JSON数据
- 8. JSGrid - 加载JSON数据 - “未找到”
- 9. 如何加载tableView中的数据
- 10. 无法将数据加载到TableView中
- 11. NSOperation无法在TableView上加载数据
- 12. Searchbar在tableView和重新加载数据
- 13. tableview中的JSON数据JAVAFX
- 14. 如何将JSON加载到TableView中?
- 15. 从JSON解析的数据不加载某些TableView单元格
- 16. 将JSON数据加载到tableview不起作用
- 17. 用Swift在TableView中显示JSON数据
- 18. 在tableview中显示数据json iphone
- 19. 在mg表中加载json给出的数据未定义
- 20. 在iphone中慢速加载Json数据
- 21. 在ListView中加载更多json数据
- 22. 在SQL Server中加载JSON数据
- 23. 在jqGrid中加载JSON数据
- 24. 在recyclerview中加载JSON数据
- 25. 在Android中加载json数据-uitableview
- 26. TableView重新加载数据未调用cellForRowAtIndexPath
- 27. 在[datafx]中使用JdbcSourceReader在TableView中加载数据
- 28. CloudKit应用数据未在tableview中
- 29. 数据未加载到数据库中
- 30. 重新加载TableView的数据?
需要更多信息。什么是不加载? UI显示?空桌子?任何错误消息? –
Plesae使用基本格式选项 – Daenarys