Access NSMutableArray from a different class

前端 未结 3 1237
自闭症患者
自闭症患者 2021-01-25 22:55

I have a class where a NSMutableArray object is formed, as so:

navBarColour = [[NSMutableArray alloc] initWithObjects:colourOfNavBar, nil];

I t

3条回答
  •  滥情空心
    2021-01-25 23:27

    (Actually, futureelite7 & Radek S aren't strictly correct, in that you don't need @property declaration to use dot notation. If there's a getter method called navBarColour then the dot notation works fine for that too. But that's another issue.)

    The declaration for the property navBarColour must visible to your code containing the NSLog. Yes, do post your header file, if you say the added @property declaration is also failing to compile then you have something weird going on. Make sure your other class' .m is including that header, and that HandlingPalettes's class isn't merely declared with a forward declaration say (@class Blah;).

    But also, is HandlingPalettes a class or an instance?!? Identifiers starting with capitol letters by convention imply its a class name, so that's suspicious. If it's a class name, then that's surely not what you want.

    (Regarding using dot notation without @property, if HandlingPalettes is indeed a class, then if you had the class method +(NSMutableArray*)navBarColour then when it would compile.)

提交回复
热议问题