BlackSheep
BlackSheep

Reputation: 1087

Using UITextField for save file

I use this function to Save a MyFile.caf

NSString *nomeFile = self.nomeBastard.text;

NSString *tempDir = NSTemporaryDirectory();
NSString *soundFilePath = [tempDir stringByAppendingString:[NSString stringWithFormat:@"%@.caf", nomeFile]];//@"sound.caf"];
NSString *outputSoundFilePath = [tempDir stringByAppendingString:[NSString stringWithFormat:@"%@0.caf", nomeFile]];//@"soundO.caf"];

soundFileURL = [[NSURL alloc] initFileURLWithPath: soundFilePath];
outputSoundFileURL = [[NSURL alloc] initFileURLWithPath: outputSoundFilePath];

[[AVAudioSession sharedInstance] setActive:YES error:nil];

my nomeBastard.text have a default value (write your name and press REC) but on saved file the value don't change, I svae always one file .caf with the first value like a:

write your name and press REC.caf

How can I get the name from my UITextField?

Here my screen first I change value on my text filed isert MyFileName

enter image description here

Whet TAP on Rec the App do not register file with name, but register 0.caf

enter image description here

Upvotes: 0

Views: 50

Answers (1)

Jordan Montel
Jordan Montel

Reputation: 8247

I think you want to reset the value and set back the placeHolder :

self.yourTextField.text = @"";
self.yourTextField.placeHolder = @"write your name and press REC";

Apply this code after saving your .caf

And if you want to change the text field with some text :

self.yourTextField.text = @"Place Some Text Here";

Upvotes: 1

Related Questions