How to take data from different classes and save them to db in one class by pressing save button?
<p>I am doing an alarm app for iOS, but I am a bit confused in taking data from different classes and save them to db in controller class.</p>

<p>for taking name, I have Name class, for taking time I have Time Class, for taking ringtone type, I have Ringtone class, so I am taking different values for one alarmTable(sqlite table) and saving them to db on save button which is in Controller.</p>

<p>I thought to take from every class and save them to delegate variables, and then fetch in controller class, is it almost successful, but having trouble in saving again default values,</p>

<p>Can anyone guide me that what is logic behind this?</p>

<p>These are variables in appDelegate</p>

<pre><code>NSString *name;
NSString *time;
NSString *repeat;
NSString *sound;
NSString *snooz;
NSString *soundFade;
NSString *volume;
NSString *vibrate;
NSString *soundName;
</code></pre>

<p>This is way of getting values from appDelegates</p>

<pre><code> -(NSString *) getName {
return name;
  }
 -(NSString *) getTime {
return time;
  }
   -(NSString *) getRepeat {
return repeat;
  }
  -(NSString *) getSound {
return sound;
   }
  -(NSString *) getSnooz {
return snooz;
   }
  -(NSString *) getSoundFade {
return soundFade;
    }
  -(NSString *) getVolume {
return volume;
  }
  -(NSString *) getVibrate {
return vibrate;
   }
</code></pre>

<p>and when I do assign values to these delegate variables, I do write in different classes are below</p>

<pre><code>      AlarmProjectAppDelegate *delegate = (AlarmProjectAppDelegate *)[[UIApplication      sharedApplication] delegate];
    [delegate setName:name_textField.text];//name_textField contain alarmname
</code></pre>

<p>and I do like this before adding to Database</p>

<pre><code>AlarmProjectAppDelegate *delegate = (AlarmProjectAppDelegate *)[[UIApplication sharedApplication] delegate];

//data for databas for new alarm start
NSString *name=[delegate getName];
NSString *time=[delegate getTime];
NSString *repeat=[delegate getRepeat];
NSString *sound=[delegate getSound];
NSString *snooz=[delegate getSnooz];
NSString *soundFade=delegate.soundFade;
NSString *volume=[delegate getVolume];
NSString *vibrate= [delegate getVibrate];
</code></pre>
