How to put several views(not images) in page view controller? - ios

I am a very starter in iOS Developing.
Now I would like to make an app of a children's story book using PageViewController. I have read some tutorials of PageViewController, but unfortunately all of them are about putting images in the PageContentViewController. I want to use views instead of images, because the content will be modified sometimes. Also, I don't want the views overlapped together because I want the workflow be visible.
I wonder whether there is a way to achieve it??? Thanks in advance!!!

Related

Implementing PageViewController in Swift

I can't seem to get a simple answer to this anywhere. I have a Page View Controller and similar lay-outs for all of the other view-controllers.
This is working without problems if I have one view-controller per view, but it seems very inefficient given that all the lay-outs are the same.
I've seen tutorials like this, but not for Swift. Is it possible to use a single view controller for all the pages and just switch out the text or images? If so, can you please explain how this is done?
All you have to do is make each page link to the same viewController and then dynamically change the content on each page based on the page number associated with it. You could easily have some elements that were hidden or diabled on certain views.

UICollectionView vs UIPageViewController

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.

(Swift) How to implement a Page Control through paging single views?

I want to implement a page control in my project so that every view can be accessed through swiping left or right. Every example I have looked at is to do with images, not views. I've been studying this and its of course images again. My application is a single view application. I'm not really sure what code snippets to give you so far, I don't think I do because I haven't done anything on this yet. If you need specifics, please comment and ask me, i'll be here all day.
Please help me!
Thanks.
The same idea should apply in the tutorial you cited. They're adding UIImageView to a UIScrollView. So in your case, instead of UIImageView just use UIView. Also you can think of the pageImages array as a data source about your views. For example, instead of an array of UIImage you can just have an array of some model object that helps you configure your view. However, keep in mind that the implementation in the tutorial for your case won't scale if you plan to have a lot of UIViews. That's because you want to effectively reuse views that aren't showing. When it gets to that point, you're better off implementing a UITableView that scrolls horizontally.
You can use UIPageViewController for paging effect. Check out this tutorial. It is written in obj-c but who cares. It will give you idea about using UIPageViewController.

Replicate iOS Photos app collection view

I'm trying to figure out the best way of managing the two list/detail view of the photos app. My main question is, is it two collection views with two separate layouts? Or is it just one that is changing its flow layout? Right now I'm using two in two separate apps, but I'm not sure if it's the best way of doing it.
EDIT: I'm talking about the grid view of photos turning into the detail view of a single photo that is also swipeable (left/right).
Thanks

What do you call this stacked folders looking view in iOS?

(source: mshcdn.com)
What is this view called?
Its like stacked folders (Cupertino, New York, Austin, Your Location) that when you touch one.
It enlarges and shows more details, is it complicated to create?
And can someone please show me a link, on how to create one?
Thanks.
It looks a lot like an Accordion.
There are a number of Accordion projects on Cocoa Controls and Cocoapods.
This is just using a UITableView and customising what happens when you tap cells.
You don't need UIKit Dynamics for something like this. Nor would I put multiple UIViews on top of each other as if there are more than a handful you'll run into memory issues.
The transition to the next screen is a custom transition. You can read more about these in WWDC 2013 video. I think it's session 218.
Or possibly in the tech talk videos available from the http://developer.apple.com website.
The iOS weather app uses a similar concept. I'm about 30% through trying to reverse engineer it. I believe it uses a UICollectionView with a layout-to-layout transition.
This is not a standard view controller layout. I think you could call this "Stacked View Controllers", as it is not per se a navigation controller (no push/pop), nor a tab bar controller, nor anything known.

Resources