Objective-C: How to access methods in other classes

后端 未结 2 1298
北海茫月
北海茫月 2021-01-15 09:35

I have what I know is a simple question, but after many searches in books and on the Internet, I can\'t seem to come up with a solution. I have a standard iPhone project th

2条回答
  •  执念已碎
    2021-01-15 10:13

    You should probably take a look at one of the many Objective C tutorials, but the direct answer to your question is that you have not allocated and initialised an instance of your object. The code should look like:

    utils = [[Utils alloc] init];
    [utils myMethod];
    

提交回复
热议问题