I have placed a uitableview inside collectionviewcell and have coded as below in the collectionviewcell class.But the datasource and delegate methods are not being called can any help me out to fix the issue
- (id)initWithCoder:(NSCoder *)aDecoder {
if (self = [super initWithCoder:aDecoder]) {
arrayMenuAlerts=[NSMutableArray arrayWithObjects:@"Suri",@"John",@"Phillip",@"Sachin", nil];
[self.contentView addSubview:tableView];
tableView.dataSource=self;
tableView.delegate=self;
}
return self;
}
- (void)awakeFromNib {
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
tableView.dataSource=self;
tableView.delegate=self;
}
This happens because on the init Method the object "self" is not created yet. you can put tableView dataSource and Delegate in another method. like i did.