Question: I am new to Objective C. On one of the developers documentation, I found the following statemenet.

**The following statement invokes the lockFocusIfCanDraw method and assigns the return value to
flag. It does not generate a compiler warning unless there is a mismatch between the type for flag
and the method’s return type. Nonetheless, this pattern is strongly discouraged.**

```
flag = aView.lockFocusIfCanDraw;

```

In addition to the one above, I can think of many situations of this kind. For instance I might want to capture the display text from a box and assign it to a local string etc.

I am just wondering, if the above statement is discouraged, what is the recommended way of handling such situation?

Answer: 
The dot syntax for calling methods should only be used for properties (i.e. when calling accessors). Since `lockFocusIfCanDraw` is not an accessor method, you should use the regular square brackets syntax, i.e. `flag = [aView lockFocusIfCanDraw];` instead.
flag = [aView lockFocusIfCanDraw];