Compile the error in action for the iPhone application: "error: expected") "before"; token "

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?

+3
source share
2 answers

I understood that. The error was in a completely different section. Figures. :)

"#define kShowSegmentIndex 0;" msgstr "#define kShowSegmentIndex 0". -, .

.

+3

Source: https://habr.com/ru/post/1711636/


All Articles