search

Home  >  Q&A  >  body text

ios - 在.m文件的interrface中的变量声明和方法声明区别?

通过拖线的方式,将控件属性放到.m文件的@interface中的变量声明方法声明中有什么不同呢,为什么放到变量申明的时候不能通过self.去访问?如图中3位置中只能访问2位置而不能访问1位置中的声明。

ringa_leeringa_lee2769 days ago576

reply all(2)I'll reply

  • PHPz

    PHPz2017-04-17 16:48:33

    self. is calling the setter and getter methods. You only declared the variable at position 1 and did not write the setter and getter methods for the property.

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 16:48:33

    @interface MyClass (Category)
    -(Abc*) testFunc;
    @end

    Those with words in the brackets are declaring a Catetory for a class

    @interface MyClass ()
    -(Abc*) testExtension;
    @end

    The blank words in the brackets are extension, and inside are the private variables and methods of this class

    reply
    0
  • Cancelreply