本文介绍了如何观察NSScroller的变化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 c>

Do you see an error in my reasoning or know a better method of how to observe the scrolling of an NSScrollview?

推荐答案

[[aScrollView contentView] setPostsBoundsChangedNotifications:YES];
[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(boundsDidChangeNotification:)
                                             name:NSViewBoundsDidChangeNotification
                                           object:[scrollView contentView]];

如,您可以获取当前滚动这样定位:

As stated in the Scroll View Programming Guide, you can get the current scroll position this way:

NSPoint currentScrollPosition = [[theScrollView contentView] bounds].origin;

这篇关于如何观察NSScroller的变化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 19:00