Maison  >  Questions et réponses  >  le corps du texte

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

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

ringa_leeringa_lee2719 Il y a quelques jours543

répondre à tous(2)je répondrai

  • PHPz

    PHPz2017-04-17 16:48:33

    self.是调用setter和getter方法,你只在位置1处做了变量声明,没有写该属性的setter和getter方法。

    répondre
    0
  • 高洛峰

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

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

    这种括号里有字的 就是给一个类声明了一个Catetory

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

    这种括号里没字的 是extension 里边都是这个类私有的变量和方法

    répondre
    0
  • Annulerrépondre