Hello guys,
I am currently developing for iPad, I am loading a path of the documents directory via a UITableView in a Popover. Via a textField, I want to change the files name. The first time, when i choose the file, the name is changed. But when I want to change the name afterwards again, nothing happens. I need to select the thing again, then enter the name again, and then it works again. :confused:
Code:
- (void)textFieldDidEndEditing:(UITextField *)tf
{
textLabel.text = textField.text;
NSString* newName = textLabel.text;
newName = [newName stringByAppendingPathExtension:@"txt"];
NSString* newPath = [[currentFilePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:newName];
NSLog(@"%@",newPath);
[[NSFileManager defaultManager] moveItemAtPath:currentFilePath toPath:newPath error:nil];
[[NSNotificationCenter defaultCenter] postNotificationName:@"DataSaved" object:nil];
}
I figured out that I needed to set at the end of the method:
Code:
currentFilePath = newPath;
But that actually gave me a EXC_BAD_ACCESS, no Idea why.
I really don't have a clue whats going on there …
Thanks in advance!