views:

92

answers:

1

I want to have user select between two different buttons on a view, If the the user selects the imageOne, a label is created called "imageOne", then I'll save the label into an array using the following technique:

- (IBAction)saveData {
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *choice = [NSString stringWithFormat:@"%@/userschoice", documentsDirectory];
    NSMutableArray *array = [[NSMutableArray alloc] init];
    [array addObject:imageOne.text];

    [array writeToFile:choice atomically:NO];
}

I'm trying to avoid using the Picker and a Tableview as I only have two choices and it will be easier for user to choose with a button. any guidance would be appreciated.

Thanks.

Michael

+1  A: 
  1. Create the button, either in Interface Builder or in code
  2. Hook up the button's delegate to point to the controller
  3. Implement a method to do something in the controller (see link from number 2)
  4. Save data
coneybeare