大家好,我无法使图像文件成为我制作的自定义 uitableview 单元格。图片太小了,不知道怎么放大。提前寻求帮助。
#import <UIKit/UIKit.h>
@interface customCell : UITableViewCell
{
//UILabel *frontLabel;
}
@property(nonatomic , strong) IBOutlet UILabel *label;
@property(nonatomic , strong) IBOutlet UILabel *label2;
@property(nonatomic , strong) IBOutlet UIImageView *imgView;
@end
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"cell";
customCell * cell =[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[customCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
// cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
User * user = [self.list objectAtIndex: indexPath.row];
cell.label.text = user.username;
NSString *url = user.profilePic;
UIImage * image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:url]]];
cell.imageView.contentMode =UIViewContentModeScaleAspectFit;
cell.imageView.image =image;
return cell;
}