Skip to main content

Posts

Showing posts with the label nsindexpath

NSRangeException when deleting cell using a different class

I looked through my code and I printed my array I was using and it appears to be fine, yet this error still persists. * Terminating app due to uncaught exception 'NSRangeException', reason: '* -[__NSArrayM removeObjectAtIndex:]: index 1 beyond bounds [0 .. 0]' My guess was that it had something to do with my indexPath but it doesn't make much different how much I change it. -(void)checkboxTapped:(id)sender { [sender setSelected:YES]; [self.textLabel setTextColor:[UIColor grayColor]]; [self.detailTextLabel setTextColor:[UIColor grayColor]]; parent = [[ViewController alloc] init]; UITableView *tableView = parent.tableView; NSMutableArray *array = [[NSMutableArray alloc] initWithArray:parent.array]; [parent release]; NSIndexPath *indexPath = [NSIndexPath indexPathForRow:[array count] inSection:1]; [array removeObjectAtIndex:[indexPath row]]; [db deleteTaskAtIndex:[indexPath row]]; [tableView deleteRowsAtIndex

error with scrollToRowAtIndexPath

I am getting an error when using my application that used tableviews, the error looks like this. 2012-01-19 10:19:51.442 bcode[1176:207] *** Terminating app due to uncaught exception 'NSRangeException', reason: '-[UITableView scrollToRowAtIndexPath:atScrollPosition:animated:]: row (3) beyond bounds (3) for section (0).' *** First throw call stack: (0x16c3052 0x1920d0a 0x166ba78 0x166b9e9 0x68a136 0x3bfdf 0x6c2fbf 0x6c32d4 0x6c35d7 0x6d2666 0x87890e 0x878c17 0x878c86 0x62c499 0x62c584 0x2718e00 0x13614f0 0x15fa833 0x15f9db4 0x15f9ccb 0x1d05879 0x1d0593e 0x5fba9b 0x2838 0x2795 0x1) terminate called throwing an exception(gdb) What is happening is that when the user drills down my navigation view they can select a cell from the tableview of each view, which later will be used to build a search string. However I allow them to go back and change their selection if they made an error.. this error happens when the user changes the value of the parent view then going into