Comments (6)
Hi @Darwinium, good quesion. In order to update a label with the current page number one needs to detect the moment when user scrolls the scroll view. It can be done by implementing a scroll view delegate with the scrollViewDidScroll
method:
- Firstly, subclass your view controller from
UIScrollViewDelegate
:
class ViewController: UIViewController, UIScrollViewDelegate {
- Secondly, assign the view controller to the delegate property of the scroll view. Make sure to assign the delegate before accessing scrollView.auk property.
override func viewDidLoad() {
super.viewDidLoad()
scrollView.delegate = self
scrollView.auk.show(...
- Finally, implement
scrollViewDidScroll
method in your view controller. In this method you can update your label with the index of the current page.
func scrollViewDidScroll(scrollView: UIScrollView) {
imageIndex.text = String(scrollView.auk.currentPageIndex)
}
Good luck and let me know how it goes.
from auk.
Hi again, evgenyneu
Thanks, it's work!
Few more questions:
- How can I bind the picture to the bottom of UIScrollView regardless of the size of the image?
Example how's now:
http://joxi.ru/krDkgY1T0z09KA
http://joxi.ru/eAO6EP0h4j4ej2 - How can I do something like this? http://joxi.ru/Q2KqgPDH9J9Q8r
Thank you again and have a nice day)
from auk.
No worries. Sorry I do not understand your question. Can you explain a bit more? Do you want to show a part of the next image in the scroll view?
from auk.
Exactly!
from auk.
Hi @Darwinium, unfortunately Auk only shows a single image at a time. But you can create such image view that shows a portion of the next image yourself. Here is a demo: https://github.com/evgenyneu/SneakPeekScroll
from auk.
Closing this issue. Feel free to reopen when needed.
from auk.
Related Issues (20)
- Scroll speed? HOT 6
- Show remote images in fullscreen HOT 1
- Resizing url loaded image HOT 7
- Slider not showing it self when you try to add 3 images or more HOT 4
- Supports scroll vertically HOT 1
- Custom view HOT 1
- Pagecontrol not display HOT 1
- image is not scaletofit, its stretched, please help HOT 1
- Content mode scaletofit HOT 1
- When I try to show only 1 image, it doesn't get loaded and shown HOT 6
- Xcode warning after last update HOT 3
- Performance issue when trying to "show" many images in a loop HOT 1
- photo has userInteraction = NO HOT 3
- Type 'UIAccessibilityTraits' (aka 'UInt64') has no member 'image'
- Loop to first image with animation going forward HOT 2
- Page Control animation lost when using viewcontroller as delegate HOT 3
- UpdatePage does not work HOT 1
- How to hide page control? HOT 4
- The request timed out Error for large images (5MB) HOT 2
- I can't detect the moving of image nor fetch any index of the array HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from auk.