NSScrollView Quickies

From macwrench
Jump to navigation Jump to search


UIScrollView Äquivalente

UIScrollView NSScrollView
[scrollView contentSize];
[[scrollView documentView] size];
[scrollView contentOffset];
[scrollView documentVisibleRect].origin;
CGSize size = CGSizeMake(w,h);
[scrollView setContentSize:size];
NSSize size = NSMakeSize(width, height);
[[scrollView documentView] setFrameSize:size];
CGPoint point = CGPointMake(x,y);
[scrollView setContentOffset:point];
NSPoint point = NSMakePoint(x,y);
[[scrollView documentView] scrollPoint:point];

animiert scrollen

[NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) {
    NSClipView *clipView = [scrollView contentView];
    NSPoint newOrigin = [clipView bounds].origin;
    newOrigin.x = 0;
    newOrigin.y = 0
    [[clipView animator] setBoundsOrigin:newOrigin];
    [scrollView reflectScrolledClipView: [scrollView contentView]];
} completionHandler:^{
}];