从 Dropbox 加载数据时,iOS UITableView 不会显示任何内容
我有一个 UITableView ,它应该在加载时显示 dropbox 中的文件夹的内容。我知道它通过使用日志语句从保管箱获取数据。从下拉框中获取数据后,我重新加载表中的数据,但它仍然没有显示任何内容。请帮忙
- (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;
}
I have a UITableView thats supposed to show the contents of a folder from dropbox when it loads. I know its getting the data from dropbox by using log statements. I reload the data in the table after it gets the data from drop box but it still shows nothing. Please help
- (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;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您只需要在发出请求时显示 ProcessIndicator
并在调用此方法时隐藏即可。
这绝对能解决你的问题。
祝您编码愉快;)
You just need to show ProcessIndicator while you are making request
And Hide when u get this method called.
This will definitely solve your problem.
Have a happy Coding ;)
没关系,我明白了。这是加载元数据的正确调用:
Never mind i got it. This was the correct call to load metadata: