I'm using Storyboard. I've read on SO that you cannot use segues when you are dealing with custom tableviewcells and as expected, it doesn't work. Even when I select a custom cell, it doesn't trigger anything.
So I've been trying to use didSelectRowAtIndexPath instead, using below code, but now it just pushes a completely blank screen with a black background. Obviously, I'm doing something wrong. How can I use a "selection row event" using a custom tableviewcell to push to a new view controller???
I will add the fact that SecondViewController is declared and designed in Storyboard. I've removed its segue so it's just floating in storyboard.
- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
SecondViewController *svc = [[SecondViewController alloc]init];
[self.navigationController pushViewController:svc animated:YES];
}
Some more code below for reference.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *simpleCellIdentifier = @"JokeCustomCell";
JokeCustomCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleCellIdentifier];
JokePL *joke = [self.jokeDataManager.jokes objectAtIndex:indexPath.row];
cell.titleLabel.text = [NSString stringWithFormat: @"%@", joke.title];
cell.scoreLabel.text = [NSString stringWithFormat: @"Score: %@", [self quickStringFromInt:joke.score]];
cell.timeLabel.text = [self turnSecondsIntegerIntoMinuteAndSecondsFormat:joke.length];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"M/dd/yy"];
cell.dateLabel.text = [NSString stringWithFormat: @"%@", [dateFormatter stringFromDate:joke.creationDate]];
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 65;
}