【发布时间】:2014-12-14 10:56:19
【问题描述】:
我需要财产的访问地址,但有问题。示例代码是
@interface Rectangle : NSObject
{
SDL_Rect wall;
SDL_Rect ground;
}
@property SDL_Rect wall;
@property SDL_Rect ground;
@end
@implementation Rectangle
@synthesize x;
@synthesize y;
@end
@interface Graphics : NSObject
{
int w;
int h;
}
-(void) drawSurface
@end
@implementation Graphics
-(void) drawSurface
{
Rectangle *rect = [[Rectangle alloc] init];
SDL_BlitSurface(camera, NULL, background, &rect.wall);
}
@end
&rect.x 是请求的属性表达式的地址
【问题讨论】:
-
你不能,它是一个属性。
-
SDL_BlitSurface(camera, NULL, background, ); - 需要的最后一个参数是 CGRect,而不仅仅是 x 值。
标签: objective-c objective-c-runtime objective-c-2.0