I’m working on tutorials in the book “Getting iPhone Developed” I am in chapter 4, and I get the following compilation error in the line if if (segment == kShowSegmentIndex):
error:expected ')' before ';' token
Here is my code:
- (IBAction)toggleShowHide:(id)sender{
UISegmentedControl *segmentedControl = (UISegmentedControl *)sender;
NSInteger segment = segmentedControl.selectedSegmentIndex;
if (segment == kShowSegmentIndex) [switchView setHidden:NO];
else [switchView setHidden:YES];
}
I compared it several times with the code in the book and reprinted it. This error seems to be caused by incorrect placement of brackets. Any suggestions?
source
share