DMCircularScrollView
DMCircularScrollView copied to clipboard
if page size is set to 320 and view width to 320, it doesnt work
any ideas why so i could fix it maybe?
if set to sometihng like 300, it can actually scroll to the left without an issue, just cant to the rigth
The problem appears to be related to the reloadData method where 'visibilePages' is calculated.
NSUInteger visiblePages = ceilf(self.frame.size.width/self.pageSize.width);
If self.frame.size.width is evenly divisible by self.pageSize.width (e.g. 320/320) the contentSize of the scrollView. I think what we need to do here is perform a modulo between the two values and if the output is 0 (i.e. the values are evenly divisible) then we want visiblePages + 1
if (fmodf(self.frame.size.width, self.pageSize.width) == 0)
{
visiblePages += 1;
}
I hope this helps.
Wrong.
should be
visiblePages += 2;
nope. should be
if (fmodf(self.frame.size.width, self.pageSize.width) == 0)
{
visiblePages += 2;
}
else
{
visiblePages += 1;
}