का पता लगाने के लिए मैंने UITableView (KRTableView के रूप में) को उप-वर्गीकृत किया है और चार स्पर्श-आधारित विधियों को लागू किया है (स्पर्श बैगन, स्पर्श किए गए, स्पर्श किए गए, और स्पर्श किए गए हैं) ताकि मैं पता लगा सकूं कि UITableView पर स्पर्श-आधारित ईवेंट को कब संभाला जा रहा है । अनिवार्य रूप से मुझे पहचानने की आवश्यकता है जब UITableView ऊपर या नीचे स्क्रॉल हो रहा है।UITableView स्क्रॉलिंग
हालांकि, UITableView को उपclassing और उपरोक्त विधियों को बनाने के दौरान केवल UITableViewCell के भीतर स्क्रॉलिंग या उंगली आंदोलन हो रहा है, पूरे UITableView पर नहीं।
जैसे ही मेरी उंगली अगले सेल पर ले जाया जाता है, स्पर्श इवेंट कुछ नहीं करते।
यह कैसे मैं UITableView उपवर्गीकरण कर रहा हूँ है:
#import "KRTableView.h"
@implementation KRTableView
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[super touchesBegan:touches withEvent:event];
NSLog(@"touches began...");
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
[super touchesMoved:touches withEvent:event];
NSLog(@"touchesMoved occured");
}
- (void)touchesCancelled:(NSSet*)touches withEvent:(UIEvent *)event {
[super touchesCancelled:touches withEvent:event];
NSLog(@"touchesCancelled occured");
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
[super touchesEnded:touches withEvent:event];
NSLog(@"A tap was detected on KRTableView");
}
@end
मैं कैसे पता लगा सकते हैं जब UITableView ऊपर या नीचे स्क्रॉल है?
viewDidScroll जब तक आप स्क्रॉल कर रहे हैं बुलाया जा रहा रखने के लिए किया जाता है। तो आप scrollViewDidScroll पर गैलेज़ करने के लिए अपने परिवर्तनीय isDragging सेट नहीं कर सकते हैं। –
क्या यह ऊपर या नीचे स्क्रॉल के बीच DISTINGUISH करने के लिए संभव है? – Markus
@ मार्कस https://stackoverflow.com/questions/2543670/finding-the-direction-of-scrolling-in-a-uiscrollview – tdios