project_files/HedgewarsMobile/Classes/VoicesViewController.m
changeset 3522 156c04c6a3d8
parent 3514 59dbd31e9953
child 3532 04e2fea3e83a
--- a/project_files/HedgewarsMobile/Classes/VoicesViewController.m	Fri Jun 18 20:45:45 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/VoicesViewController.m	Sat Jun 19 00:48:47 2010 +0200
@@ -27,6 +27,12 @@
     srandom(time(NULL));
 
     openal_init(20);
+    voiceBeingPlayed = -1;
+
+    // load all the voices names and store them into voiceArray
+    // it's here and not in viewWillAppear because user cannot add/remove them
+    NSArray *array = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:VOICES_DIRECTORY() error:NULL];
+    self.voiceArray = array;
 }
 
 - (void)viewWillAppear:(BOOL)animated {
@@ -34,20 +40,9 @@
     
     // this moves the tableview to the top
     [self.tableView setContentOffset:CGPointMake(0,0) animated:NO];
-    voiceBeingPlayed = -1;
-
-    // load all the voices names and store them into voiceArray
-    NSArray *array = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:VOICES_DIRECTORY() error:NULL];
-    self.voiceArray = array;
 }
 
-/*
-- (void)viewDidAppear:(BOOL)animated {
-    [super viewDidAppear:animated];
-}
-*/
-
-- (void)viewWillDisappear:(BOOL)animated {
+-(void) viewWillDisappear:(BOOL)animated {
     [super viewWillDisappear:animated];
     if(voiceBeingPlayed >= 0) {
         openal_stopsound(voiceBeingPlayed);