I am saving a NSMutableArray with different objectsForKeys.
I am having Three of the object be set by input by the user.
I would like to be able to append the new object text with .caf and .txt. So when these are called in the next viewController they can be recognized and used.
Here is my code:
Does anyone have any suggestions?
I am having Three of the object be set by input by the user.
I would like to be able to append the new object text with .caf and .txt. So when these are called in the next viewController they can be recognized and used.
Here is my code:
Code:
- (void)saveAction:(id)sender {
[self.nameTextField resignFirstResponder];
[self.imageNameTextField resignFirstResponder];
NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"main.caf",@"pictureAudioKey",
@"audio1.m4a",@"firstAudioKey",
@"audio2.m4a",@"secondAudioKey",
@"audio3.m4a",@"thirdAudioKey",
@"audio4.m4a",@"fourthAudioKey",
@"audio5.m4a",@"fifthAudioKey",
@"audio6.m4a",@"sixthAudioKey",
@"main.jpg",@"photoimagekey",
@"some.txt", @"identity",
@"imagename.txt",@"numberkey",nil];
//here is where I change the object values by what the user puts into the textfield imagename.text
This works fine especially for the photo since it is recognized as a png without the extension and loaded
[dictionary setObject:[[self imageNameTextField]text]
forKey:@"photoimagekey"];
//However when you strip the .txt from a text file...or the .caf from an audio //file they are not recognized and not loaded.
[dictionary setObject:[[self imageNameTextField]text]
forKey:@"identity"];
//I tried this
//identity=[identity stringByAppendingFormat:@"txt" But it didn't work
NSString *audioString = [dictionary objectForKey:@"pictureAudioKey"];
audioString = [audioString stringByAppendingFormat:@".caf"];
[dictionary setObject:[[self imageNameTextField]text]
forKey:@"pictureAudioKey"];