TableViewCell.h里面
#import <UIKit/UIKit.h>
#import “DataModel.h”
NS_ASSUME_NONNULL_BEGIN
@interface TableViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIImageView *img;
@property (weak, nonatomic) IBOutlet UILabel *zhu;
@property (weak, nonatomic) IBOutlet UILabel *fu;
-(void)loadData:(DataModel *)mod;
@end
NS_ASSUME_NONNULL_END
TableViewCell.m
#import “TableViewCell.h”
@implementation TableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
-(void)loadData:(DataModel *)mod{
if (mod) {
self.zhu.text=mod.title;
self.fu.text=mod.mtime;
self.img.image=[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:mod.imgsrc]]];
}
}
-
(void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];// Configure the view for the selected state
}