iphone UIPicker question
- by Rob
I have a picker that prompts the user to choose a gender and an age group (17-21, 22-26, etc.)
These 2 choices determine which view the user will be brought to after pressing the button, but I am having troubles writing the method for that button. The code I have so far is this:
- (IBAction) buttonPressed {
NSInteger genderRow = [genderPicker selectedRowInComponent:0];
NSString *genderSelected = [genderPickerData objectAtIndex:genderRow];
NSInteger ageRow = [agePicker selectedRowInComponent:1];
NSString *ageSelected = [agePickerData objectAtIndex:ageRow];
if (genderSelected == "Male" && ageSelected == "17-21") {
Calc2ViewController *calc2ViewController = [[Calc2ViewController alloc] initWithNibName:@"Calc2View" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:calc2ViewController animated:YES];
[calc2ViewController release];
calc2ViewController = nil;
}
}
When I run the program, and select these 2 groups (Male and 17-21) - nothing happens. What am I missing?