Xcode complains about ” Expected expression required” for second else if statement in my code. Ive tried using parenthesis from code I had looked at on here but that didn’t work and not sure what expression it wants now? Works fine until I add a second else if
I realise this is probably basic objective C stuff but having never done an if statement for more then two items im a bit stuck
-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
if ([text1 isFirstResponder])return arrStatus.count;
else
if ([text2 isFirstResponder]);return arrStatus2.count;
else ///<<<<< wants an expected expression here
if ([text3 isFirstResponder]);return arrStatus2.count;
}
You have spurious semi-colons after some of the
ifstatements:Other than that your code is poorly indented and you should stop putting statements on the same line as the
if/else iflines: