Im working on a Countries and Capitals app as part of an Objective-C Course.
So far when the user selects a Country in the picker the relevent Capital City is displayed in the label below.
My question is how can I code it so the Capital City is displayed only after the user clicks the "Get Capital" button.
I know this seems less efficient but it would be useful to know how!
countryNames =[[NSArray alloc]initWithObjects:@"England",
@"United States",
@"India",
@"Australia",
@"Canada",
@"France",
@"The Netherlands",
@"South Africa",nil];
cityNames =[[NSArray alloc]initWithObjects:@"London",
@"Washington DC",
@"Dehli",
@"Canberra",
@"Ottawa",
@"Paris",
@"Amsterdam",
@"Cape Town",nil];
-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
lblcapitalCity.text =[cityNames objectAtIndex:row];
}
// Not sure after doing this how to only display cities after a button is clicked
[pickerView selectedRowInComponent:0]
– David Berry