Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Chapter 16 comments

In this chapter there are some small things that a bit confusing:

1) in QuartsFun project, some properties are used in "_property_name" notation (_firstTouch), while others are uses in "self.property_name" notation (self.redrawRect). 

2) in QuartsFun we define fistTouch as

@property (nonatomic) CGPoint firstTouch;

while in GLFun we define fistTouch as

@property CGPoint firstTouch;

((nonatomic) is missing)

3) in GLFun project, for one of the touched method, we use

UITouch* touch = [[event touchesForView:self] anyObject];


while on two others, we continue to use 


UITouch *touch = [touches anyObject];


For all those 3 cases, if that was made on purpose, it would be nice to give an explanation why. If there is no any special reason to do that, it would be less confusing to stick with the same pattern all the times.

Comments

  • I'm a bit confused as well.  It appears that the QuartzFun project is constantly referencing the iVars directly rather than use the accessors the declared properties created.

    It was my understanding that setting or getting iVars directly was considered bad form and that's why we went to the effort to declare the properties.

    From initWitCoder and all the touch handlers, changeShape: , drawRect:  all use the backing iVars and not accessors.

    What is the motivation here or am I misunderstanding something?

    Thanks in advance.


  • Is it only me?

    //issues

    // 1)initWithCoder did not get the color coding of source code.


    // 2) runtime warning

    //      2013-07-24 21:51:24.877 QuartzFun[5731:c07] Unknown class BIDQuartzFunView in

    //      Interface Builder file.



    //solution

    // Go to the "ProjectName" , click on it , and then go the "Build phases" tab , and then click on the

    // "compile sources" , and then click on "+" button , a window will appear , the choose "BIDQuartzFunView.m"

    // file and then click "add" ,

    // Build the Project and Run it , the problem will surely get solved out.


    The book did not state to do this.

  • HELP!!!
    after writing the code for optimization of the QuartzFun, I can not draw any shapes.
    Has anyone experienced this?

  • ok, found the problem. I was spelling - (CGRect)currentRect wrong.  My bad.
Sign In or Register to comment.