iOS UITableView赢得';从Dropbox加载数据时不显示任何内容
我有一个UITableView,它应该在dropbox加载时显示文件夹的内容。我知道它是通过日志语句从dropbox获取数据的。在表从下拉框中获取数据后,我重新加载了表中的数据,但它仍然没有显示任何内容。请帮忙iOS UITableView赢得';从Dropbox加载数据时不显示任何内容,ios,uitableview,dropbox,Ios,Uitableview,Dropbox,我有一个UITableView,它应该在dropbox加载时显示文件夹的内容。我知道它是通过日志语句从dropbox获取数据的。在表从下拉框中获取数据后,我重新加载了表中的数据,但它仍然没有显示任何内容。请帮忙 - (void)viewDidLoad { [super viewDidLoad]; // Uncomment the following line to preserve selection between presentations. // self.cle
- (void)viewDidLoad
{
[super viewDidLoad];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
uploadFileButton = [[UIBarButtonItem alloc] initWithTitle:@"Upload" style:UIBarButtonItemStyleBordered target:self action:@selector(uploadFile:)];
self.navigationItem.rightBarButtonItem = self.editButtonItem;
self.navigationItem.leftBarButtonItem = uploadFileButton;
self.title = @"DropBox";
[[self restClient] loadMetadata:@"/"];
}
- (void)restClient:(DBRestClient*)client loadedMetadata:(DBMetadata*)metadata {
for (DBMetadata *file in metadata.contents) {
NSLog(@"\t%@", file.filename);
[dropBoxArray addObject:file.filename];
}
NSLog(@"%@", dropBoxArray);
[self.tableView reloadData];
}
- (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.textLabel.text = [dropBoxArray objectAtIndex:indexPath.row];
NSLog(@"%@", cell.textLabel.text);
return cell;
}
没关系,我拿到了。这是加载元数据的正确调用:
[[self restClient] loadMetadata:@""];
没关系,我拿到了。这是加载元数据的正确调用:
[[self restClient] loadMetadata:@""];
您只需要在发出请求时显示ProcessIndicator
- (void)viewDidLoad
{
[super viewDidLoad];
uploadFileButton = [[UIBarButtonItem alloc] initWithTitle:@"Upload" style:UIBarButtonItemStyleBordered target:self action:@selector(uploadFile:)];
self.navigationItem.rightBarButtonItem = self.editButtonItem;
self.navigationItem.leftBarButtonItem = uploadFileButton;
self.title = @"DropBox";
[[self restClient] loadMetadata:@"/"];
[self showProcessIndicator]; //Your code for showing ProcessIndicator
}
并在调用此方法时隐藏
- (void)restClient:(DBRestClient*)client loadedMetadata:(DBMetadata*)metadata {
for (DBMetadata *file in metadata.contents) {
NSLog(@"\t%@", file.filename);
[dropBoxArray addObject:file.filename];
}
NSLog(@"%@", dropBoxArray);
[self.tableView reloadData];
[self hideProcessIndicator];
}
这肯定会解决你的问题。
祝您愉快;) 您只需在发出请求时显示ProcessIndicator
- (void)viewDidLoad
{
[super viewDidLoad];
uploadFileButton = [[UIBarButtonItem alloc] initWithTitle:@"Upload" style:UIBarButtonItemStyleBordered target:self action:@selector(uploadFile:)];
self.navigationItem.rightBarButtonItem = self.editButtonItem;
self.navigationItem.leftBarButtonItem = uploadFileButton;
self.title = @"DropBox";
[[self restClient] loadMetadata:@"/"];
[self showProcessIndicator]; //Your code for showing ProcessIndicator
}
并在调用此方法时隐藏
- (void)restClient:(DBRestClient*)client loadedMetadata:(DBMetadata*)metadata {
for (DBMetadata *file in metadata.contents) {
NSLog(@"\t%@", file.filename);
[dropBoxArray addObject:file.filename];
}
NSLog(@"%@", dropBoxArray);
[self.tableView reloadData];
[self hideProcessIndicator];
}
这肯定会解决你的问题。
祝您愉快;) 谢谢你的回答,但我从二月份开始就没做过这个。我在问如何从dropbox加载文件。谢谢你的回答,但我从二月份开始就没做过这个。我在问如何从dropbox加载文件。谢谢你。