我正在嘗試學習石英的基礎知識,不明白爲什麼這不起作用 - 當按鈕被按下時,它應該將紅色矩形移動到右邊,蝙蝠在媽媽身上,它不會做任何事情 - 了「的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