我正在尝试学习石英的基础知识,不明白为什么这不起作用 - 当按钮被按下时,它应该将红色矩形移动到右边,蝙蝠在妈妈身上,它不会做任何事情 - 了“的NSLog(A”帮助“),就是揣摩,如果按钮被运作 - 感谢在石英中移动矩形
@implementation QuartzView
-(IBAction)moveRight:(id)sender{
NSLog(@"Help");
lR += 50;
}
- (id)initWithFrame:(NSRect)frameRect
{
self = [super initWithFrame:frameRect];
if (self) {
}
return self;
}
- (void)drawRect:(NSRect)dirtyRect
{
CGContextRef myContext = [[NSGraphicsContext // 1
currentContext] graphicsPort];
// Drawing code here.
CGContextSetRGBFillColor (myContext, 1, 0, 0, 1);// 3
CGContextFillRect (myContext, CGRectMake (lR, 0, 200, 100));
[self setNeedsDisplay:YES];
}
@end
感谢
拍,我的意思的最后一行说“CGRectMake(LR,0,200,100)); – user2073270 2013-02-14 19:09:31
修正为你您可以编辑您的帖子,顺便说一句 – Jeremy 2013-02-14 19:17:24