Alternative to assign return values

I am new to Objective C. In one of the developer documentation, I found the following statemenet.

The following statement calls the lockFocusIfCanDraw method and sets the return value to the flag. It does not generate a compiler warning if there is no mismatch between the type for the flag and the methods return the type. However, this template is very discouraged.

flag = aView.lockFocusIfCanDraw;

In addition to the above, I can think of many situations of this kind. For example, I might want to grab the displayed text from a window and assign it to a local line, etc.

I am just wondering if the above statement is not encouraged, what is the recommended way to handle this situation?

+3
source share
2

(.. ). lockFocusIfCanDraw , , .. flag = [aView lockFocusIfCanDraw];.

+5

flag = [aView lockFocusIfCanDraw];

+2

All Articles