我正在创建一个应用程序,在其中将我的注册用户可视化到 Parse.com 的数据浏览器(在 TableView 控制器中),并将所选单元格的数据步进到新的视图控制器中。
我的问题是我无法在新的视图控制器中查看图像,您能告诉我该怎么做吗?我正在尝试了解和调查各种论坛上的 argormento,但在论坛上找不到答案,Parse 已经很长时间没有答案了。
这是我正在处理的代码:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{ if ([segue.identifier isEqualToString:@"Visual"]){
NSIndexPath *indexPath = [self.Tork indexPathForSelectedRow];
PFObject *object = [self.objects objectAtIndex:indexPath.row];
ViewController *detailViewController = [segue destinationViewController];
detailViewController.oggetto = object; } }
表视图:
- (PFQuery *)queryForTable {
PFQuery *query = [PFQuery queryWithClassName:@"_User"];
[query whereKeyExists:@"username"];
[query whereKeyExists:@"picture"];
[query whereKeyExists:@"email"];
// If no objects are loaded in memory, we look to the cache first to fill the table
// and then subsequently do a query against the network.
if ([self.objects count] == 0) {
query.cachePolicy = kPFCachePolicyCacheThenNetwork; }
[query orderByAscending:@"username"];
return query; }
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
// Configure the cell
cell.textLabel.text = [object objectForKey:@"username"];
cell.detailTextLabel.text = [object objectForKey:@"email"]];
cell.imageView.image = [UIImage imageNamed:@"none.png"];
PFFile *file = [object objectForKey:@"picture"];
[file getDataInBackgroundWithBlock:^(NSData *data, NSError *error) {
cell.imageView.image =[UIImage imageWithData:data];
}];
return cell;
}