2013-04-22 68 views
1

我目前使用的是NSScrollView,当我滚动它内部的按钮时,它会重新显示在它下面。我怎样才能解决这个问题。NSScrollview项目在滚动时不能正常显示

这里的问题显示:enter image description here

int x = 00; //position x 
    int y = 00; //pssition y 

    int width = 100; 
    int height = 40; 

    NSButton* a = [[NSButton alloc] initWithFrame:NSMakeRect(x, y, width, height)]; 
    a.title = @"Scene"; 
    //[a setButtonType:<#(NSButtonType)#>]; //Set what type button You want 
    [a setBezelStyle:NSSquareLineCapStyle]; //Set what style You want 

    [self.box addSubview:a]; 

现在,我知道该按钮被正确显示,它看起来当我滚动,它越来越像重绘。我不想让第一个底部的底部显示出来。

回答

0

我可能会离开这里,但它可以与我从我做的教程中得到的一行代码一起。乒乓球比赛。这样球就会在屏幕上移动时重新绘制。该行是:

[NSTimer scheduledTimerWithTimeInterval:0.01 
           target:self 
           selector:@selector(gameLoop) 
           userInfo:nil 
           repeats:YES]; 

希望这对帮助!如果不希望它给你更多的想法?