The problem is that you are trying to add NSIndexPath
as a text for the UILabel
You can't do this
NSIndexPath *newIndex = [NSIndexPath indexPathWithIndex:loadrows];
self.objects[indexPath.row]=newIndex;
Then doing this
cell.textLabel.text=self.objects[indexPath.row];
In the first part you are adding an NSIndexPath and then treating it as NSString and add it to the UILabel.
Update 1
To Save the order of the cells you can save the entire array (since it is array of strings)
In moveRowAtIndexPath:
method add this at the end
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
[userDefaults setObject:self.objects forKey:@"saverows"];
[userDefaults synchronize];
- Remove what you are doing under
save indexPath
indidSelectRowAtIndexPath
method - Remove What you are doing under
load indexPath
incellForRowAtIndexPath
method
In viewDidLoad
method add the following
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
self.objects = [userDefaults objectForKey:@"saverows"];