Custom Cell TableView iOS Objective C




Create a new file with xib,

-> MyCustomCellTableViewCell.h

#import <UIKit/UIKit.h>

@interface MyCustomCellTableViewCell : UITableViewCell

@property (weak, nonatomic) IBOutlet UIImageView *img;

@property (weak, nonatomic) IBOutlet UILabel *lbl;

@property (weak, nonatomic) IBOutlet UIButton *btnDownload;

@end


Now goto TableView, 

-> In Newsletter.m,

#import "MyCustomCellTableViewCell.h"

In viewDidLoad,

   UINib *nib=[UINib nibWithNibName:@"MyCustomCellTableViewCell" bundle:nil];
    
    if(nib)
    {
        [_tbl_Newsletter registerNib:nib forCellReuseIdentifier:cell_id];
    }

In
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath{


 MyCustomCellTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:cell_id];
    
    
    cell.lbl.text=@“”;

}




Comments