I have MainViewController calling WebViewController (From UICatalog sample application) In WebViewController I make some function setValue(){...} to set some value passed as parameter to the variable (NSString *value) from WebViewController.h but when I try from MainViewController something like WebViewController targetViewController... targetViewController.setValue(value), it says: "error: request for member 'setValue' in something not s structure or union"...
If you have a property named "value", and use @sythesize to create a method for you, in which case you call using that "." notation:
targetViewController.value = whatever;
Or you can call the setter outright regardless of you or the @synthesize writing the method:
[targetViewController setValue:whatever];
The property syntax (class.property = whatever) is really just a shortcut of calling a "setValue:" method, and in return the @property and @synthesize mechanisms of properties are just writing a helpful bit of code for you.
Edit: I had said before if you just wrote a "setValue:" method you could call it using the "class.value = newValue" notation, but that was incorrect - you have to define an @property to use "." notation.
I believe that
targetViewController.value = whatever;
will only work if you already have the @property declared; if not, you'll need to use the full method calling syntax:
[targetViewController setValue: whatever];
Otherwise, Kendall is correct about using setters and @synthesize.
Also your syntax is written using procedural C
targetViewController.setValue(value);
which definitely won't work.