我无法在UICollectionViewCell
中设置图片,但UILabel
工作正常。这是相关代码:
// CatagoryViewCell.m
#import "CatagoryViewCell.h"
@implementation CatagoryViewCell
@synthesize nameLabel;
- (void)setImage:(UIImage *)image
{
[catagoryCellImage setImage:image];
}
@end
// ViewController.m
UIImage *image = [UIImage imageNamed:@"canon.jpg"];
[cell setImage:image];
return cell;
谢谢!
答案 0 :(得分:0)
请尝试以下代码
//cell.h
#import <UIKit/UIKit.h>
@interface detail : UITableViewCell
@property (nonatomic, retain) IBOutlet UIButton *check;
@property (nonatomic, retain) IBOutlet UIImageView *img;
@end
// cell.m
#import "cell.h"
@implementation detail
@synthesize option, img;
// ViewController.m
cell.img.image= [UIImage imageNamed:@"canon.jpg"];
return cell;