Ios 解析和填充TableView

Ios 解析和填充TableView,ios,uitableview,parse-platform,Ios,Uitableview,Parse Platform,我已经试着这么做了几天了,我被卡住了。我正在使用parse作为后端。我不想使用parse自己的ParseTableView来设置我的视图。在我开始一个更难的应用程序之前,我想了解这个基本应用程序的情况。如何使用parse中的数据填充我的表???多谢各位 // // ViewController.m // BraveRetiredNumbers // #import "ViewController.h" @interface ViewController () @property (st

我已经试着这么做了几天了,我被卡住了。我正在使用parse作为后端。我不想使用parse自己的ParseTableView来设置我的视图。在我开始一个更难的应用程序之前,我想了解这个基本应用程序的情况。如何使用parse中的数据填充我的表???多谢各位

//
//  ViewController.m
//  BraveRetiredNumbers
//

#import "ViewController.h"


@interface ViewController ()
@property (strong, nonatomic) IBOutlet UITableView *playerTableView;
@property (strong, nonatomic) NSArray *testArrary;
@property (strong, nonatomic) NSString *parseClassName;
@end

@implementation ViewController


@synthesize testArrary;
@synthesize playerArray;
@synthesize playerTableView;

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    [self performSelector:@selector(retrieveFromParse)];
    self.testArrary = @[@"Apple",@"Banana",@"Peach",@"Grape",@"Strawberry",@"Watermelon"];


}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.

    }

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [self.playerArray count];
    //return [testArrary count];
}

- (void) retrieveFromParse {

    PFQuery *query = [PFQuery queryWithClassName:@"Player"];

    [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
        NSLog(@"%@\n",objects);
        if (!error) {
            playerArray = [[NSArray alloc] initWithArray:objects];

        }
    }];

    [playerTableView reloadData];

}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

    [playerTableView deselectRowAtIndexPath:indexPath animated:YES];

}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *SimpleIdentifier = @"playerCell";

    UITableViewCell *cell = [playerTableView dequeueReusableCellWithIdentifier:SimpleIdentifier];

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


    //PFObject *tempObject = [playerArray objectAtIndex:indexPath.row];

    //NSDictionary *tempDic = [playerArray objectAtIndex:@"playerName"];

    cell.textLabel.text = [tempDic objectForKey:@"playerName"];

    //cell.textLabel.text = [testArrary objectAtIndex:indexPath.row];
    return cell;
}


@end

我认为实现您想要的最好方法是发出异步请求来解析、获取结果并像往常一样在TableView中显示它们。但我看不出有任何理由这么做。那么,您将如何通过代码实现这一点呢?请查看Parse.com文档。下面是生成异步请求的代码:请求完成后,在应用程序中存储值,并像往常一样显示。