2014-01-07 183 views
0

我有一個使用NIB的自定義PFTableViewCell。我所有的自定義標籤都會顯示,但我的PFImageView沒有。我將所有內容都更改爲UIImageView,以確保它在我的Parse調用中沒有出現問題,但即使在我的資源中設置了靜態圖像,我也無法使其工作。自定義單元格不顯示PFImageView?

我的小區班級設置爲foodCell,foodcell.h設置爲所有者。

下面是該ImageView的截圖上我NIB

這是我foodCell.h展現PFImageView的出口:

#import <Parse/Parse.h> 

@interface foodCell : PFTableViewCell 

@property (weak, nonatomic) IBOutlet NSObject *foodCell; 

@property (weak, nonatomic) IBOutlet UILabel *priceLabel; 

@property (weak, nonatomic) IBOutlet UILabel *foodDescription; 

@property (weak, nonatomic) IBOutlet UILabel *foodTitle; 

@property (strong, nonatomic) IBOutlet PFImageView *foodPic; 

@end 

現在,這裏是我配置我的細胞。同樣,我所有的其他代碼在這裏工作,除了foodCell.foodPic.file

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object { 

    static NSString *CellIdentifier = @"foodCell"; 
    foodCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; 

    if (cell == nil) { 
     cell = [[foodCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier]; 

    } 

    cell.foodPic.file = [object objectForKey:@"foodImage"]; 
    cell.foodTitle.text = [object objectForKey:@"foodName"]; 
    cell.foodDescription.text = [object objectForKey:@"foodDescription"]; 

    NSString *myString = [@"$" stringByAppendingString:[NSString stringWithFormat:@"%[email protected]", [object objectForKey:@"foodPrice"]]]; 

    cell.priceLabel.text = myString; 

    return cell; 
} 

回答

4

按照解析文檔,你應該叫loadInBackgroundPFImageView

cell.foodPic.file = [object objectForKey:@"foodImage"]; 
[cell.foodPic loadInBackground]; 
相關問題