Reputation: 384
When parsing a local XML file i can see the data in console using NSLog. While in the simulator am getting only the plain table view without any data parsed from xml. Am not understanding where am missing it.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: CellIdentifier];
if(cell == nil){
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
theLists = [app.listArray objectAtIndex:indexPath.row];
cell.textLabel.text = theLists.title;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
Upvotes: 1
Views: 3170
Reputation: 967
Figured I should add this, if you are having trouble with data not showing up or loading.
Make sure your tableview delegate and data source are set to self.
So in the viewcontroller's viewDidLoad() function, make sure you add
tableView.delegate = self
tableView.dataSource = self
Upvotes: 0
Reputation: 384
I got the answer finally where i didn't properly connected the tableview controller class with corresponding controller. I followed the link Trouble making connections with story board
And finally it showed the data in the table view. Hope this answer might help others. Thanks for all the people who gave their suggestions in this post.
Upvotes: 0
Reputation: 493
I think there are two expected reasons for that:
1- May be the number of sections and number of row are not set with the correct value.
2- may be you need to reload the table view data.
Please check these two methods:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 5; // or any number you want
}
Upvotes: 0
Reputation: 2707
It seems you are reloading in the DidLoad.But After parsing and getting the data from xml, You have to reload that data with TableView.
[yourtableView reloadData];
Before doing thing, be sure that you have set Delegate and DataSource.
Upvotes: 0
Reputation: 871
I think you are not reloading your table view. after completing your parsing just reload your table view.
[reload tablename];
then check your table view delegates are calling or not after this method. I think this will help you.
happy coding.
Upvotes: 2