2

i built an app on ios 4.3 and it worked fine but when i run it on the new ios the back buttons dont work. Heres my code to go to the next xib:

-(IBAction)Selection3Page:(id)sender;{ //show next view Selection3Page * nvc = [[Selection3Page alloc] initWithNibName:nil bundle:nil]; [self presentModalViewController:nvc animated:NO]; [nvc release]; }

and this is the code to return back to the first xib:

-(IBAction)done:(id)sender{
[self.parentViewController dismissModalViewControllerAnimated:NO];

}

please help!!

user975767
  • 51
  • 1
  • 6

2 Answers2

4

The API for dismissing modal views was changed somewhat in iOS 5. Try this instead:

if ([self respondsToSelector:@selector(dismissViewControllerAnimated:completion:)])
{
    NSLog(@"didTouchDoneButton 5.x");
    [self dismissViewControllerAnimated:YES completion:nil];
}
else
{
    NSLog(@"didTouchDoneButton 4.x");
    [self dismissModalViewControllerAnimated:YES];
}
typeoneerror
  • 55,990
  • 32
  • 132
  • 223
-1

post some NSLogs in there somewhere and check if the methods are actually getting called... I would start around that..

Sergio Campamá
  • 746
  • 1
  • 7
  • 14
  • how would i be able to do that here? sorry im new to coding – user975767 Oct 16 '11 at 17:12
  • Place this inside the functions, at the top... `NSLog("Function called");` When clicking on the function, check the log if this comments appear... Correctly placing the NSLogs could help you find where the program stops working... – Sergio Campamá Oct 17 '11 at 12:43