iOS : How to reference a music background from a singleton class?

前端 未结 3 1411
闹比i
闹比i 2020-12-22 08:53

I have done a singleton class called MyBgMusic.h & MyBgMusic.m. How to reference that singleton class to my SecondViewController or the rest of the XIB.

Here is

3条回答
  •  無奈伤痛
    2020-12-22 09:05

    You have to import your class and reference it wherever you want using this line :

    [[MyBgMusic sharedManager] toggleMusic]
    

    If you want, you can add even property and reference it without create an instance of your class.

提交回复
热议问题