I'm trying to add an image programmatically in a custom tableviewcell but it display it like this:

I would like it like this:
(like a notification)
Here is my code:
ViewController.m
@implementation albumsSingerVC
- (void)viewDidLoad{
_matableview.delegate = self;
_matableview.dataSource = self;
}
- ( nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
static NSString *MyIdentifier = @"customCell";
customCellSingersAlbumVC *cell = (customCellSingersAlbumVC*)[tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil)
{
[tableView registerNib:[UINib nibWithNibName:@"customCellSingersAlbumView" bundle:nil] forCellReuseIdentifier:MyIdentifier];
}
cell = (customCellSingersAlbumVC *)[tableView dequeueReusableCellWithIdentifier:MyIdentifier];
UIImageView *imageview = [[UIImageView alloc] init];
UIImage *myimg = [UIImage imageNamed:@"pink.png"];
imageview.image=myimg;
imageview.frame = CGRectMake(50, 50, 150, 150); //I also
changed the values to a small ones.
[[cell imageView ] addSubview:imageview];
return cell;
}
@end
I tried it with differents syntax.
I also tried to do it different :
customCell.m:
@implementation customCellSingersAlbumVC
- (void)viewDidLoad{
UIImageView *imageview = [[UIImageView alloc] init];
UIImage *myimg = [UIImage imageNamed:@"pink.png"];
imageview.image=myimg;
imageview.frame = CGRectMake(50, 50, 150, 150);
[self.contentView addSubview:imageview];
}
@end
but viewdidload is never triggered.
Hi I finally found how to do it here is the code if someone is interested: