user1996384
user1996384

Reputation: 29

Application tried to present a nil modal view controller error

I've been trying to push a uiwebview from a tableview to no avail. This is the code I have right now and whenever I click the cell, it would crash and show me the error.

Courses.m

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

[tableView deselectRowAtIndexPath:indexPath animated:YES];

if ([[array objectAtIndex:indexPath.row] isEqual:@"GolfClub"])
{
    Blue *changi = [[Blue alloc] initWithNibName:@"Golf Club" bundle:nil];
    [self.navigationController pushViewController:changi animated:YES];
    [changi release];
}
else if ([[array objectAtIndex:indexPath.row] isEqual:@"ExecutiveGolfCourse"])
{
     ExecutiveGolfCourse *egc = [[ExecutiveGolfCourse alloc] initWithNibName:@"Executive Golf Course" bundle:nil];
    [self.navigationController pushViewController:egc animated:YES];
    [egc release];
}

newsClicked.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:newsClicked animated:YES];
}

Upvotes: 0

Views: 518

Answers (1)

shabbirv
shabbirv

Reputation: 9098

initWithNibName  is not meant for the title of your ViewController

nib name is actually the name of the .xib file that is associated with that ViewController

Upvotes: 1

Related Questions