Page View Controller :custom page slider - ios

I am trying to implement a feature using PageViewController in iOS Swift language. In my scenario there will be images on all views associated with PageViewController. I will have buttons on top of images, (refer to example app's screenshot.) How can I implement that with change of page only the image slides not the buttons.

Finally I was able to do it, by following steps:
In your storyboard, create a standard Viewcontroller scene.
To this scene add your fixed buttons and a container view. Adding
the container view will automatically add an embedded view
controller. Select this and delete it.
Drag a Page view controller into the storyboard.
Select the container view and drag from the "viewDidLoad" item in
its "triggered segues" list to the page view controller. Select
"Embed" as the segue type.

Following delegate methods are to display dots of page controller, dots will appear at bottom of view.
presentationCountForPageViewController
presentationIndexForPageViewController
For your requirement need to create custom UIButtongroup or UIView group, so that you can place it anywhere in page.

Related

How to work on View added outside to the main view of ViewController in Storyboards?

I have created a registration form and in which user can select his Gender. On tapping the button of Gender, I need to show a custom view. I want to use Storyboard for creating view but I cannot work on that as I cannot see it without adding that on the main View of the View Controller. Please see the image below. I want to keep that view separate from the main view of the View Controller and I will add that view programmatically when user will tap on the gender Button.
You can't add a UIView to the canvas in storyboard, it needs to be contained in a UIViewController.
Your options are:
1) Create a xib file for your UIView subclass and design it there.
Then import it by calling -loadNibNamed: on the main bundle.
2) Do the design layout programmatically inside your UIView subclass.
3) Add a container view to your main VC and use the view controller it generates to design your gender view. Then you can start with it hidden and show it when the gender button is tapped.
• Put it as a subview
• Design it
• Put it back there outside of the view controller

Storyboard: can't drag view to viewcontroller

I'm new to iOS, I'm following this tutorial: http://www.appcoda.com/uipageviewcontroller-storyboard-tutorial/. I just drag and dropped a Page View Controller to the storyboard, and tried to drag an Image View into it, but it bounce back, what am I missing?
When manipulating the content of ViewControllers in storyboards, the zoomlevel must be set to 100%. You might want to check this (simply doubleclick on the ViewController).
UIPageViewController is a container view controller, so you can't put individual views in one in Interface Builder. You need to create one or more individual content view controllers and control-drag from the page view controller to the page content controller and then put actual content in the page content controller.
Walk through the tutorial again, but this time note the references to "page content view controller"

How to make slide menu static or re-useable iOS?

I am trying to make the slide menu re-useable without having to constantly add the same menu to every viewController in the menu drawer. How can I re-use, can I wrap all my view controllers within some type of main controller?
You could create a new root view controller which contains the slide menu and also contains a container view that covers the entire size of the screen.
Within the container view you would embed your old root view controller.
The slide menu is now available to every view controller in your application and you can make it appear or disappear when you want by animating its frame origin to slide onto and off of the screen.
You could use AMSlideOutNavigation
https://github.com/andreamazz/SlideOutNavigation

Designing view on top of multiple embed views

I have the task to design a application that has a main view which is always visible (it has a button on it's bottom side, and when pressed a image displays on top of all views), and a set of TableControllerView's that should appear under it, and the user needs to be able to navigate through them.
I know that you can embed a view inside another, but you cannot refer more than one view to it. The current way I'm trying to do now load one TableViewController inside the embed view, and when the user clicks the cell I manually load the other controller and add it as a child of the main view, which is the RootViewController. The problem with this approach is that the navigation bar gets stuck using the root view controller, so I have to manipulate the main navigation items on each subview transition, and second is that the frame for the second view I load is coming as it had full size, making some cells be under the main view button. This way doesn't uses segues for transition, so it makes the storyboard kinda useless.
I was thinking into using a TabViewController with it's tab hidden, but wanted to ask here for a better solution.
As you discovered, a TableViewController likes to fill up the whole screen (except navigation bars, tab bars, status bar, etc. which are official Cocoa Touch GUIs). When you want a table view to fill only part of the screen, you are supposed to use a UITableView but not a UITableViewController. You set your custom view controller object (subclass of UIViewController, not UITableViewController) as the table view delegate and data source. You will need to duplicate part of the functionality of UITableViewController in your custom view controller, but it's not a lot more than you have to do already to supply the data.
You should probably follow the standard design pattern and have separate view controller objects for each of the "pages" the user can navigate to. You just have a main button and image on each of them. But I could imagine why that might not give you exactly the effect you want.

Adding UIPageView as a portion of a screen

Pretty new to iOS development and curious whether something is possible and if so the best want to do it.
I'd like to make a UIPageViewController be a portion of the screen. I.e., I want to have a menu bar, perhaps some additional controls and then place the page view controller on a portion of that page (so the menu bar isn't part of the page turning control). In other words, a UIPageView that acts like a scrollView that doesn't take up the whole screen.
Acceptable design?
Thanks.
Yes, this is possible, and the implementation is very easy.
Steps (implemented in XCode 6 using Storyboards)
Begin with an empty view controller.
Add a Container View from the object library on the right. The Container View may automatically embed in a regular View Controller, in which case you can just delete the View Controller because we want to embed a Page View Controller.
Select a Page View Controller from the object library on the right, and place it wherever you want in your Storyboard.
Ctrl Click + drag from the Container View to the Page View Controller, and select embed from the menu that appears. The Page View Controller should automatically resize itself to be the same size as the Container View in the original View Controller.
A nice example from apple developer sample code: PageControl. Implemented with UIScrollView and UIPageControl.
Also you may want to create a new iOS project with template "Page-Based Application". The template code is implemented with UIPageViewController.
Both implementation employ View Controller Containment.
BTW: the is no UIPageView, only UIPageControl or UIPageViewController.
You can Try Below link for uipageviewcontroller Tutorial
http://www.techotopia.com/index.php/An_Example_iOS_5_iPhone_UIPageViewController_Application
U can Try uiview for pageturning not uiviewcontroller
u can add uiview to uiviewcontroller.
like [Self.view addSubview:youruiview];
and Remove uiview controller like [youruiview removefromsuperview];
Thanks..!

Resources