I keep seeing apps that appear to be tabbed view controller apps, where the user can easily swipe left or right between views.
How do I enable that kind of behavior?
Thanks.
The best and least hassle free solution I found is Andrey Tarantsov's ATPagingViev class. Works just like a UITableView, i.e. how many pages do you want, scroll horiz or vert. provide view for page, etc. Very easy and well coded. It's here: SoloComponents
It also has a recycling feature so it's memory stable.
If you refer to something like Apples photo app, it is using UIScrollView which has a property to enable paging.
If you define the views content width wider than your view's frame, you'll get the effect you describe. The view will page in steps of it's bounds width.
On each page you can place another view.
http://developer.apple.com/library/ios/DOCUMENTATION/UIKit/Reference/UIScrollView_Class/Reference/UIScrollView.html
Another option I found is SwipeView:
https://github.com/nicklockwood/SwipeView
Related
I need to have different full screen views in my app. Very similar to how snapchat works. The views should be able to communicate between each other.
My question is: Should I use a UICollectionView with cells same size as the screen or should I use UIPageViewController?
Please provide some background info to support your opinion!
I think both have pretty different purposes.
UICollectionView is great to build a mosaic of views (think an image gallery for instance), whereas UIPageViewController is kind of similar to the flipping pages of a book. The latter seems to be what you need, but UIPVC doesn't seem to offer many tweaking/customizations, like custom transitions for example. In which case you may want to start from a UIScrollView with paging enabled to recreate something similar but with more potential. Here's an example.
Personal opinion: for this specific case I'd use a page view controller. Collection views have any things you have to consider, like when the device rotates you have to recalculate where you are, which cell you have to display, ask to scroll to the current cell, and if you are displaying a video or using the camera you might have to control it perfectly, otherwise issues will come.
However think about new features that might be added to your app, if you think you might show more than 2 items on screen, then you'd better choose a collection view.
A page view controller lets the user navigate between pages of
content, where each page is managed by its own view controller object.
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIPageViewControllerClassReferenceClassRef/
So If you plan to swipe from one ViewController to another, go for PageViewController. If you plan to have only one ViewController that deal with a list of fullscreen image or so, go for a view controller with a collectionView, or maybe your own swipeView.
UIPageViewController use different view controller and load multiple controller so obvisioly take more memory as compared to UICollectionView. So if your required task is less calculation or step to do then its recommended to use UICollectionView, other case preferred way is to user UIPageController.
I'm creating an app that will have a quick onboarding at the beginning with some pretty simple scroll through animations and finish with a button to basically "GO" into the app's content.
I'm looking for suggestions as for how to most effectively and efficiently develop this, here's some things that it needs:
there should be paging so that it locks onto about 4 different positions throughout the onboarding.
the animations progress should be dependent on the scroll view's position (I'm guessing the x value of the content offset)
there needs to be views that stay on screen through multiple pages and some that move on screen and off screen throughout the onboard, it can not just be one picture moving on then off
there needs to be a button that pops up on the last page
I have a good understanding of Scroll Views, Page Views, and Page Controls. I also just bought Core Animator (the app) if anyone can suggest how implement that.
The way that I'm thinking of doing it is basically creating a Scroll View with paging that is empty and just use it to control animations with its content offset. Is there a faster way to do this or maybe a open source library that would work better? I'm only proficient in Swift currently :?
Thanks for any suggestions! This my first app and I'm very excited to hear your suggestions
I would look at UIPageViewController as its setup to do the scrolling by page for you, although you have control over what kind of animation it uses. You are responsible for feeding it view controllers to display using this method:
setViewControllers(_:direction:animated:completion:)
here is the link to the apple documentation UIPageViewController docs
I created a scrolling credits screen for one of my company's apps, FaceDancer, that would be a decent starting point for what you are after. The app is free. You can download it to check it out at this link: FaceDancer. The credits screen is off the info button on the main screen.
It's not hard to use UIView animations to simply animate a series of views. I think that might be easier than working with a scroll view.
I can give you some guidance if you think it would be helpful.
I am trying to make an app that you can scroll through and it displays a different string on each page. I though I should use scroll views as they seem to be how I can do this. An example of what I want is UberFacts app. This app you can scroll along and it has a different fact each time. This is obviously not just thousands of different view controllers that are linked by the page control. How do I make view controllers work like UberFacts?
Thanks!
UberFacts seem to use a paginated ScrollView and each page looks like a vertical ScrollView also (you can see by the bounce). But is just one ViewController that manage all those pages.
I would like to use Pager Sliding TabStrip in my project.Pager Sliding Tapstrip is there for android. Can we define like this? I have taken one scroll view, added subviews on it for tables and take one uivew, added buttons as subviews and added uilabel as subview for tabstrip . While using the scrollview means dragging the scrollview, the tabsrip has to be moved.I have been stuck to this concept and i am not getting any idea to solve this issue. How do i get this concept? Please give any idea to me anyone.
Can't you use UIPageControl for this ?
From Apple example:
https://developer.apple.com/library/ios/samplecode/PageControl/Introduction/Intro.html#//apple_ref/doc/uid/DTS40007795
And to have a custom UIPageControl, like this https://github.com/Spaceman-Labs/SMPageControl .
You can try UIPageViewController to manage your tabs.
I'm not sure how many tabs do you have. If you have many tabs and you add all tables into the scrollView at the beginning time, the performance and memory usage would be really bad.
So you'd better reuse controller and views for your tabs. If you use UIScrollView and manage them by yourself, what you can do is calculate current page according to the contentOffset, and load the current page, previous page and next page. Because three pages is enough to cover what user will see. However the better solution is using UIPageViewController, it will deal with contentOffset and pagination, what your need to do is just provide previous controller and next controller according to current controller. Then update your tab view according to current controller.
EDIT:
BTW, if by "the tabstrip has to be moved" you mean when you drag the scrollView, your tabstrip moves as well, that's because you added your tabstrip to the scrollView. What you need to do is add it to the root view, and the scrollView and the tabstrip should be siblings rather than parent and child.
I am developing application which required same features as asked by you.
I am using SHViewPageController. You can find it from following link.
https://www.cocoacontrols.com/controls/shviewpagerexample
I hope it will help you. Thanks.
This may help you....
you can change the tab at top or bottom. also it has got some nice customizations
https://github.com/iltercengiz/ICViewPager
So what I'm looking to do is have a UIPageViewController that will end up displaying three view controller vies, one fully visible and then two as previews to the right and left. An example would be the iOS6 App Store:
Is doing this using a UIPageViewController set to UIPageViewControllerTransitionStyleScroll possible?
Basically I'd ideally like to have is a case where I can have three UIViewControllers that I recycle as the user pages through the 1- items in the list (with n being at least 50). I know an interface that behaves like this can be done with a UIScrollView with paging enable, but re-using views would take some view shuffling code that I'd rather not write if Apple has already done it for me.
I'm totally comfortable with the fact that this is iOS6 only, by the way, and also comfortable with alternatives, if they exist.
Thanks!
Check the new collection view. I think you may be able to create something like that with reusing cell etc.