0
votes

I am facing a different problem in navigation ,i have three view controllers,bookselectionview,chapterselectionview and verseselectionview,the bookselectionview contains books of Bible if we tap genesis it navigate to genesis chapterpage and if the chapter is selected from the view it navigate to the corespondent chapters verse view,i have close button in chapter view and verse view if the user tap the verse close button it wants to pop to the corespondent chpterview,that is like the back button in the navigation bar,but i created the custom button for that,my problem is when i tap the back button it cress the application.this is my code in viewwillapper of the chpterview

[button addTarget:self action:@selector(ButtonClicked:) forControlEvents:UIControlEventTouchUpInside];

 -(void)ButtonClicked:(UIButton *)sender{
        VersusSelectionView *detailViewController = [[VersusSelectionView alloc] initWithNibName:@"VersusSelectionView" bundle:nil];

    //detailViewController.firstString = firstString;
    // ...
    // Pass the selected object to the new view controller.
    detailViewController.selectedChapter=[sender.titleLabel.text intValue];
    appDelegate.selectedChapterIndex=[sender.titleLabel.text intValue];
    self.hidesBottomBarWhenPushed=YES;
    [self.navigationController pushViewController:detailViewController animated:YES];

    [detailViewController release];
}

the above code navigate t the verse page in versepage viewwillappear

[button addTarget:self action:@selector(ButtonClicked:) forControlEvents:UIControlEventTouchUpInside];

in verseselectionview closebuttonclick

-(IBAction)_clcikbtnclosetochptervew:(id)sender
{
[self.navigationController popViewControllerAnimated:YES];
}

when tapping close buon it pop the chpterview and crash the app. any error in my code? please help me to do this.Thanks.

1
Please include a crash log when asking questions about your app crashing. - jrturton
@jrturton my app crash in main "program received signal "EXC_BAD_ACCESS" - ICoder
Type bt in the debugger window to get a backtrace, this will tell you what was happening at the time the error was encountered. - jrturton
@jrturton sir where in debugger window?i can't understand it.plz.thanks - ICoder
The pane that pops up at the bottom of your xcode window, it will say gdb or similar in there with a prompt >. This is the debugger, it is your friend :) - jrturton

1 Answers

2
votes

Check the -(void)dealloc method of VersusSelectionView class.