NSScrollview不支持滚动条的系统首选项(滚动时),而我重写了-tile方法

时间:2012-07-04 07:33:25

标签: macos nsscrollview tile scroller

下面是我的代码,它覆盖了水平滚动条上的控件。

- (void)tile
{
    [super tile];
    if (subControl)
    {
        NSRect subControlFrame = [subControl frame];

        NSScroller *horizontalScroller = [self horizontalScroller];

        NSRect scrollerFrame = [horizontalScroller frame];

        // adjust control position here in the scrollview coordinate space
        subControlFrame.origin.x = scrollerFrame.origin.x;
        subControlFrame.origin.y = scrollerFrame.origin.y;
        subControlFrame.size.height = scrollerFrame.size.height;
        // move controls
        [subControl setFrame:subControlFrame];

        NSRect subControlFrame2 = [subControl frame];

        scrollerFrame.origin.x += subControlFrame2.size.width;

        scrollerFrame.size.width -= subControlFrame2.size.width;

        [horizontalScroller setFrame:scrollerFrame];
    }
}

行后

    [subControl setFrame:subControlFrame];

它停止响应系统首选项?

0 个答案:

没有答案