Reply:
The following code is the code I scrollView slide download the core code. I hope you have a reference.
/ / SzVision - indicates the range of visible
/ / SzItem - represent each displayed in a single product size
scrollview/ / SzDiff - represents the distance between each item
- (NSMutableSet *) getDownloadIndexSetForVerticalStyle: (int) nColNums
{
assert (self.showsVerticalScrollIndicator == YES);
if (self.contentOffset.y <0)
return nil;
NSMutableSet * setVisionIndex = [[NSMutableSet alloc] init];
int nUpExposeHeight = 0;
int nVisionRowNums = 0;
int nVisionStartRowMark = -1 ;/ / invalid value is -1, the minimum value is 0, the subsequent plus 1
if (self.contentOffset.y> = -0.1 && self.contentOffset.y <= 0.1)
{
nUpExposeHeight = 0;
if (self.szVision.height
/ / Get the first line of all item numbers
nVisionRowNums = 1;
nVisionStartRowMark = 0;
[Self pushVisionIndexToSet: & setVisionIndex withVSRM: nVisionStartRowMark withVRN: nVisionRowNums withCN: nColNums];
}
else
{
nVisionStartRowMark = 0;
nVisionRowNums = (((self.szVision.height-self.szItem.height) + (self.szDiff.height + self.szItem.height-1)) / (self.szDiff.height + self.szItem.height)) + 1;
[Self pushVisionIndexToSet: & setVisionIndex withVSRM: nVisionStartRowMark withVRN: nVisionRowNums withCN: nColNums];
}
}
else if ((self.contentOffset.y <= self.szItem.height) && (self.contentOffset.y> 0))
{
nVisionStartRowMark = 0;
nUpExposeHeight = self.szItem.height - self.contentOffset.y;
int nLeaveVisionHeight = self.szVision.height - nUpExposeHeight;
nVisionRowNums = ((nLeaveVisionHeight + (self.szDiff.height + self.szItem.height-1)) / (self.szDiff.height + self.szItem.height)) + 1;
[Self pushVisionIndexToSet: & setVisionIndex withVSRM: nVisionStartRowMark withVRN: nVisionRowNums withCN: nColNums];
}
else
{
nVisionStartRowMark = (((self.contentOffset.y-self.szItem.height) + (self.szDiff.height + self.szItem.height-1)) / (self.szDiff.height + self.szItem.height));
nUpExposeHeight = (nVisionStartRowMark * (self.szDiff.height + self.szItem.height) + self.szDiff.height) - self.contentOffset.y;
int nLeaveVisionHeight = self.szVision.height - nUpExposeHeight;
nVisionRowNums = ((nLeaveVisionHeight + (self.szDiff.height + self.szItem.height-1)) / (self.szDiff.height + self.szItem.height)) + 1;
[Self pushVisionIndexToSet: & setVisionIndex withVSRM: nVisionStartRowMark withVRN: nVisionRowNums withCN: nColNums] ;/ / SV_CLOTHES_COL_NUMS
}
return setVisionIndex;
}
No comments:
Post a Comment