error message: expected ')' before 'NSRect'
I am having a st开发者_运维百科range error in the program. However, I do not find any syntax error. The error is: expected ')' before 'NSRect'. How can I get rid of it? I get those errors in line 1 and 2. I also tried importing Foundation/NSGraphics.h. It did not work.
#import <Foundation/Foundation.h>
@interface MyQuartzView : NSObject {
}
- (id)initWithFrame:(NSRect)frameRect;//line 1
- (void)drawRect:(NSRect)rect;//line 2
@end
NSRect, NSSize, NSPoint, and similar types aren't available on the iPhone. Use CGRect/CGSize/CGPoint instead.
I dont know why its not defined from the foundation header but try using CGRect.
It is functionally equivalent and is defined in the foundation headers
From Apple's docs:
When building for 64 bit systems, or building 32 bit like 64 bit, NSRect is typedef’d to CGRect.
精彩评论