Question

I'm having a problem with what should be a very simple thing. I want to create an NSArrayController and specify the class it manages. Problem is, I can't figure out the correct way to specify the Class in the setObjectClass method. I want to do the following:

[projectArrayController setObjectClass:SKHProject];

SKHProject is a class that I've imported in the implementation file. I keep getting the "Expected expression before 'SKHProject'" error, but I can't figure out the correct expression. Where am I going wrong?

Was it helpful?

Solution

Do

[projectArrayController setObjectClass:[SKHProject class]];

!

OTHER TIPS

Just found it

[projectArrayController setObjectClass:[SKHProject class]];

Thanks anyway

You can only use a class name as the receiver of a message; you can't use it in any other context. So, to pass the Class somewhere, send it a message asking it for itself: [SKHProjectClass class].

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top