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

Michael Robinson
  • 1,439
  • 2
  • 16
  • 23

1 Answers1

1
  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
Community
  • 1
  • 1
coneybeare
  • 33,113
  • 21
  • 131
  • 183