You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Stefan, thank you for your contribution to the iOS programmers community
I have a problem with the library. I've switched recently from UIPageViewController to this library, to have more control over paging animation, specifically I need a slower damping, when a page swipes.
So as the README says I should access the internal scrollview and:
, but Xcode says: Value of type 'SCPageViewController' has no member 'scrollView'
I've seen the code and I know there is such member, I can get other members like 'layouter' but not this one that I really care about.
Thanks,
In my case I had to add this line to the generated '.h' file of my sub-project (of my multi module project):
#import "SCScrollView/SCScrollView.h"
Also, can you elaborate more on the approach you introduced in the second link? 'fast' deceleration is just like a regular page controller. 'normal' one is boringly slow. I want something in between. As a matter of fact I was thinking the transition animations will effect the scroll view, but it seems it only works when I manually switch pages
The idea is nothing groundbreaking but it might involve a lot more math than you're prepared to write 😁
Get the target content offset and velocity from scrollViewWillEndDragging:withVelocity:targetContentOffset:
Intercept scrollViewDidEndDragging:willDecelerate: and stop the scroll view from its normal deceleration
Use a custom timing function in the - (void)setContentOffset:(CGPoint)contentOffset easingFunction:(id<SCEasingFunctionProtocol>)easingFunction duration:(CFTimeInterval)duration completion:(void(^)(void))completion; method to take it to its final resting place.
The trick is to that you'll need to match the easing function perfectly to the velocity you got in step 1) to get a fluid animation.
Hey man,
I really need to implement this functionality. The problem is that I can not set a custom delegate for scrollView, delegate methods does not get called. Also (successfully) setting this delegate I believe will break the core functionality of the library.
I tried overriding these methods in my custom class which inherits from SCPageViewController, but these methods are not visible.
Any ideas?
Well you could subclass the pageViewController and override those scrollView delegate methods, you could swizzle them or even go as far as creating your own scrollView and modifying the the pageViewController to take it as a dependency.
Activity
stefanceriu commentedon Oct 4, 2018
Hi there and thank you, it's always nice seeing other people use your components.
I think all you have to do is import it into your bridging header, like in the swift demo here https://github.com/stefanceriu/SCPageViewController/blob/master/Demo/SwiftDemo/SwiftDemo-Bridging-Header.h#L12
This issue might also be of interest: Remove deceleration delay when paging
Cheers
Ashkan-Sarlak commentedon Oct 4, 2018
Thanks,
In my case I had to add this line to the generated '.h' file of my sub-project (of my multi module project):
#import "SCScrollView/SCScrollView.h"Also, can you elaborate more on the approach you introduced in the second link? 'fast' deceleration is just like a regular page controller. 'normal' one is boringly slow. I want something in between. As a matter of fact I was thinking the transition animations will effect the scroll view, but it seems it only works when I manually switch pages
stefanceriu commentedon Oct 5, 2018
The idea is nothing groundbreaking but it might involve a lot more math than you're prepared to write 😁
scrollViewWillEndDragging:withVelocity:targetContentOffset:scrollViewDidEndDragging:willDecelerate:and stop the scroll view from its normal deceleration- (void)setContentOffset:(CGPoint)contentOffset easingFunction:(id<SCEasingFunctionProtocol>)easingFunction duration:(CFTimeInterval)duration completion:(void(^)(void))completion;method to take it to its final resting place.The trick is to that you'll need to match the easing function perfectly to the velocity you got in step 1) to get a fluid animation.
Hope this makes sense 🙃
Ashkan-Sarlak commentedon Oct 9, 2018
Hey man,
I really need to implement this functionality. The problem is that I can not set a custom delegate for scrollView, delegate methods does not get called. Also (successfully) setting this delegate I believe will break the core functionality of the library.
I tried overriding these methods in my custom class which inherits from
SCPageViewController, but these methods are not visible.Any ideas?
stefanceriu commentedon Oct 15, 2018
Well you could subclass the pageViewController and override those scrollView delegate methods, you could swizzle them or even go as far as creating your own scrollView and modifying the the pageViewController to take it as a dependency.