Accessing variables of another class in xcode

前端 未结 5 408
一向
一向 2021-01-24 11:52

I have a balloonGameViewController.h and another class I made called balloon.h

I want to access some variables I set in balloon.h

5条回答
  •  不思量自难忘°
    2021-01-24 12:43

    i don't know if i got your question well, but i faced that once upon a time , i couldn't access the variables via (.) operator but via (->)

    in my case there were 2 classes : MenuCalss , and ToolsClass ;

    in ToolsClass.h :
    @public
        bool ToolBarVisible;
    

    //in MenuCalss there was a ToolsClassObject. ToolsClassObject is an instance of type ToolsClass, which can be created by importing the ToolsClass.h and initializing a new instance.

    , and the access way in MenuClass.m is :

    ToolsClassObject->ToolBarVisible = false;
    

提交回复
热议问题