views:

28

answers:

3

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?

+2  A: 

Do

[projectArrayController setObjectClass:[SKHProject class]];

!

Yuji
A: 

Just found it

[projectArrayController setObjectClass:[SKHProject class]];

Thanks anyway

Shawn
A: 

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].

Peter Hosey