-1

There are many topics like this but haven't find any which could help me.

my .h file:

-(void) function;

my .m file:

-(void) function {
   /*some basic switch statement for showing images in imageview*/
}

- (IBAction)do_the_function_button:(id)sender {
    function();
}

Where is the mistake? I'm sure it's something very trivial.

TomasJ
  • 289
  • 8
  • 21

1 Answers1

5

You created a method, which should be called like this [self function];, NOT function();, which is how you call a function.

There is lots of info about the differences between methods and functions floating around, here is one random post I found for instance:

objective c difference between functions and methods

Community
  • 1
  • 1
Dima
  • 23,484
  • 6
  • 56
  • 83