0

I am using this code to push my next view controller, it was working fine with IOS 7, now I have changed the deployment target to 6.1. I am calling this code from tableview cell's didSelectRowAtIndexPath. Its causing a crash when the cell is tapped only the first time, afterward goes smooth. There is no crash log. It is still working fine on iOS 7.

UIViewController *view = [self.storyboard instantiateViewControllerWithIdentifier:@"Test"];
[self.navigationController pushViewController:view animated:YES];

I tried setting "animated=NO" it works fine

[self.navigationController pushViewController:view animated:NO];

Where is the problem? Also, I am setting cell's background color in cellForRowAtIndexPath, in iOS 7 shows the color but not in iOS 6.1

Ali Sufyan
  • 2,038
  • 3
  • 17
  • 27

1 Answers1

0

change:

UIViewController *view = [self.storyboard instantiateViewControllerWithIdentifier:@"Test"];
[self.navigationController pushViewController:view animated:YES];

with:

UIViewController *view =(UIViewController *) [self.storyboard instantiateViewControllerWithIdentifier:@"Test"];
[self.navigationController pushViewController:view animated:YES];
Ilario
  • 5,979
  • 2
  • 32
  • 46
  • @AzkaarAli why not try to use - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender to go to detailview, since you're using the storyboard? – Ilario Oct 31 '13 at 17:11
  • In my case I am calling different View controllers from each cell. How can I draw a separate Segue for every call? – Ali Sufyan Oct 31 '13 at 17:17
  • @AzkaarAli Why do not recall the same viewcontroller and it only changes the content? otherwise you could try connecting each cell to correct detail and the method I wrote above you could use this code: if ([[segue identifier] isEqualToString:@"detail1"]) {} else if ([[segue identifier] isEqualToString:@"detail2"]) ... – Ilario Oct 31 '13 at 17:30