我有一个使用NIB的自定义PFTableViewCell
。我会显示所有自定义标签,但我的PFImageView
却没有。我将所有内容更改为UIImageView
只是为了确保我的Parse调用没有问题,但即使在我的资源中设置静态图像,我也无法使其工作。
我的单元格的类设置为foodCell
,foodcell.h设置为所有者。
以下是显示我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:@"%1@", [object objectForKey:@"foodPrice"]]];
cell.priceLabel.text = myString;
return cell;
}
答案 0 :(得分:4)
根据Parse文档,您应该为loadInBackground
PFImageView
cell.foodPic.file = [object objectForKey:@"foodImage"];
[cell.foodPic loadInBackground];
答案 1 :(得分:0)
同时在AppDelegate.m [PFImageView class]
方法中调用didFinishLaunchWithOptions:
。
来源:https://parse.com/questions/using-pfimageview-with-storyboard