I currently have a tableView with custom cells, which I called AMPFeedbackTableViewCell. Cells load perfectly fine.
Here is the code:
-(UITableViewCell*) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
AMPFeedbackTableViewCell* cell = (AMPFeedbackTableViewCell*) [tableView dequeueReusableCellWithIdentifier:@"feedbackCell"];
if (cell == nil)
{
cell = [[AMPFeedbackTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"feedbackCell"];
cell.currentFeedback = [[AMPFeedback alloc] init];
cell.currentFeedback = [_feedbackArray objectAtIndex:indexPath.row];
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"FeedbackTableCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
I am trying to pass something to a cell before it starts, as in this case, _currentFeedback. The custom cell has an AMPFeedback element, and I want it to set it before loading. So I can use it as follows: (NOTE: this is in AMPFeedbackTableViewCell
- (void)awakeFromNib
{
if (_currentFeedback != nil)
[self loadImages];
}
However, the current feedback is always zero. Is there a way to pass this and then call awakeFromNib?
Thanks in advance
source
share