0

I have 2 textFields and 1 textView on a view. Only one of the textFields has the vc as a delegate. Whenever any of the 3 become firstResponder (either programmatically, or by being tapped), the app crashes. The error is:

*** Terminating app due to uncaught exception 'NSRangeException', reason: '-[UITableView scrollToRowAtIndexPath:atScrollPosition:animated:]: row (0) beyond bounds (0) for section (0).'

I have a tableView that i add programmatically as a subview, but I've removed all traces of the tableView from the h and m files and still get an error that references the tableView. This vc gets pushed from a tableViewController, could that be what is being referenced?

It crashes for the simulator on both iPhone and iPad using 6.1 and 5.1, also for iPhone using 6.1.3, but it works fine on an iPad running 6.1.3.

Any ideas?

Thanks

Shane Rayner
  • 672
  • 6
  • 8
  • In the view controller with the three text boxes, what is the base class? I'm guessing it is based on `UITableViewController`. – Jeffery Thomas May 09 '13 at 01:17
  • The base class is UIViewController. That is why the tableView error has me totally stumped. I have commented out every trace of the tableView from both the h and m files just to test it, and it still gets the same error. I am using nibs, but the tableView was just being added programatically. – Shane Rayner May 09 '13 at 02:04

1 Answers1

0

Did you first try cleaning your project? Also are you using any storyboard/nibs with the file?

MichaelScaria
  • 1,560
  • 2
  • 16
  • 25
  • Yes, I have cleaned the project multiple times as well as restarting XCode and the simulator. I am using nibs. – Shane Rayner May 09 '13 at 02:02
  • In the nib, make sure there isn't any tableview references in the File Owner Connections. – MichaelScaria May 09 '13 at 02:53
  • There isn't any reference. I was creating the tableView programmatically - but i checked anyhow =D – Shane Rayner May 09 '13 at 03:02
  • 1
    Search for where ever you use `scrollToRowAtIndexPath:atScrollPosition:animated` the bug might be there. That's all I can think of, maybe there's an issue in the way the vc is coming on? – MichaelScaria May 09 '13 at 03:09
  • That was it. I had a keyboardDidShow notification in another vc - from a different navigation controller too. In that I have the scrollToRow that was causing the crash. Thanks for your help. =D – Shane Rayner May 09 '13 at 13:14