क्यों लौटाता है मेरे पास UICollectionView
UIViewController
में निहित है जो क्षैतिज UICollectionViewFlowLayout
का उपयोग करता है। मैं अपने UIStoryboard
में बनाए गए प्रोटोटाइप सेल का भी उपयोग कर रहा हूं। मैं एक कस्टम पेजिंग बनाना चाहता हूं, इसलिए मैं - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset
का उपयोग कर रहा हूं।indexPathForItemAtPoint हमेशा शून्य
समस्या यह है कि हर बार जब मैं 0Cको लक्ष्यकंटऑफसेट (स्क्रॉल दृश्य में बिंदु जहां स्क्रॉल रुक जाएगा) के अनुरूप प्राप्त करने का प्रयास कर रहा हूं, तो संग्रह दृश्य शून्य में वापस आता है भले ही बिंदु संग्रह के अंदर स्पष्ट रूप से हो सामग्री आकार देखें।
- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset
{
NSIndexPath *indexPath = [_collectionView indexPathForItemAtPoint:(*targetContentOffset)];
// Do something with indexPath
}
मैं क्या गलत कर रहा हूं?
आप इवर क्यों प्रयोग कर रहे हैं? जांचें कि '_collectionView' स्वयं पहले शून्य है या नहीं। – 7usam
मैंने scrollView चर का उपयोग करने का प्रयास किया है लेकिन परिणाम वही है। जब मैं विधि को कॉल करता हूं तो मैं सकारात्मक नहीं हूं। – DrMonkey68