How to access a variable from inner class

后端 未结 2 1837
面向向阳花
面向向阳花 2021-01-18 07:29
 //MainClass.m 

 @interface InnerClass : NSObject{

 }
 @end

 @implementation InnerClass

 -(void)run{
      while(isActive){//want to access this variable which d         


        
2条回答
  •  孤城傲影
    2021-01-18 08:27

    Objective-C doesn't have inner classes. Consider making isActive a property of MainClass, give InnerClass a pointer to an instance of MainClass, and let InnerClass simply access the property.

提交回复
热议问题