views:

52

answers:

1

Hi all,

I'm working on this iphone app that has a view controller to record some sound using AVAudioRecorder. I want to have another "setting" view controller that can change the record settings (recording format, quality etc.). Is there a way to create a singleton object for AVAudioRecorder(something like [AVAudioRecorder sharedInstance]) so that I can refer to the same recorder object in another view controller?

A: 

The settings are stored in a dictionary. Have you considered creating and storing the settings in an NSDictionary, and passing that around to the code that actually starts the recording? You will probably need to init a new AVAudioRecorder every time you want to change the settings because the property is readonly; i.e., you can only change the settings when you init the recorder.

RibaldEddie
Thanks. I didn't know the property is readonly. So I guess I'll have to create a global NSDictionary to pass around then?
Jinru
Why would you need to create a global variable to do this?
RibaldEddie
Because I need to change the setting from another view controller. Do you have any better way to do this? Anyway, I figured it out. Just need to pass a global bool flag to toggle the setting.
Jinru