getters and setters

- (id)foo {

  return foo;

}

- (void)setFoo:(id)aFoo {

  if(aFoo != foo) {

    [aFoo retain];

    [foo release];

    foo = aFoo;

  }

}

@property

@synthesize    in the implementation file

Button_FunViewController.m

we will tell the compiler to create the getter and setter methods at compile time.

  

原文地址:https://www.cnblogs.com/yushunwu/p/2687352.html