문제

I'm creating mac application to create a pList file with coordinates for views to be use in iPhone/iPad but I'm getting this error "no known class method for selector valueWithCGRect".

Here is my code:

NSMutableArray *locations = [NSMutableArray new];
[locations addObject:[NSValue valueWithCGRect:CGRectMake(50,50,280,323)]];

Any of you knows how can I fix this or if is a work around this to fix my mac app.

I'll really appreciate you help.

도움이 되었습니까?

해결책

On Mac OS there's +[NSValue valueWithRect:]. It takes an NSRect but on 64 bit that's just a typedef'd CGRect.

Bear in mind that you can't put arbitrary NSValues into a plist.

다른 팁

Can you check if you have imported UIKit ? Just add:

#import <UIKit/UIKit.h>

and the your code should work.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top