2012-12-16 22 views
5

स्क्रॉल कर रहा है या नहीं, मैं यह कैसे पता लगा सकता हूं कि मेरा NSScrollView वर्तमान में स्क्रॉल कर रहा है या नहीं? आईओएस पर मैं प्रतिनिधि का उपयोग कर सकता हूं लेकिन बहुत कुछ करने के बावजूद मुझे मैक पर ऐसा करने का कोई तरीका नहीं मिल रहा है।यह पता लगाने के लिए कि क्या NSScrollView वर्तमान में

अग्रिम धन्यवाद!

उत्तर

13

आप नीचे दिए गए

NSView *contentView = [scrollview contentView]; 

[contentView setPostsBoundsChangedNotifications:YES]; 

// a register for those notifications on the content view. 
[[NSNotificationCenter defaultCenter] addObserver:self 
             selector:@selector(boundDidChange:) 
              name:NSViewBoundsDidChangeNotification 
              object:contentView]; 

से पता चला की तरह सूचना विधि

- (void)boundDidChange:(NSNotification *)notification { 
    // get the changed content view from the notification 
    NSClipView *changedContentView=[notification object]; 
} 
2

ओएस एक्स 10.9 के रूप में वहाँ भी NSScrollViewWillStartLiveScrollNotification अधिसूचना NSViewBoundsDidChangeNotification प्राप्त कर सकते हैं। यह उपयोगकर्ता स्क्रॉल ईवेंट की शुरुआत में मुख्य धागे पर पोस्ट किया गया है।

संबंधित मुद्दे