Adding UIPageView as a portion of a screen - ios

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..!

Related

How to commonly use a storyboard's view component?

I have a storyboard with a view controller(Menu View Controller), in which if the navigation bar’s menu button is pressed, a menu like view slides into the screen. I achieved this by animating the trailing constraint of the left menu view, from 0 to a value and vice-in-versa.
The storyboard looks like,
Now, by this method I have a slide-in slide-out menu view,
end result is like,
now what if I need to use it as a common component in more than one view controllers?
Can I have this menu view controller in a separate storyboard and then refer it from my another view controller?
Should I include the left menu view in every view controllers or is there any other smart ways to achieve this?
Use MMDrawer controller library which is best suitable for you and easy to integrate. Which can provide you left drawer and right drawer and which you can use in multiple controller.
Also you can manage these 2 components in 2 different VC so it will be easy to manage code.
To integrate follow this link:
https://github.com/mutualmobile/MMDrawerController
I recommend checking out this AppCoda tutorial. This tutorial explains how to use the SWRevealViewController, which is a "A UIViewController subclass for revealing a rear (left and/or right) view controller behind a front controller". Both the Github page and the AppCoda tutorial explain on how to implement this side menu. This solution is super simple and very reusable!
UPDATE: Added more context around the external link.

Page View Controller :custom page slider

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.

Partial segue to show settings view

in the google maps app for ios. When you select the settings button, it will show you a view of options such as "traffic", "public transit", etc.
My question is how this is done on ios.
I tried following this tutorial but it says that it won't work on uinavigationviewcrollers. I have seen this partial segue of the the view in apps that use a navigational controller. How do they create that?
It's not a partial segue. It's not a segue at all, it use of containment view controllers.
Instead of a single view controller which transitions to a different view controller image one single master view controller. For simplicity, we'll say this view controller has two views (of the root), both of which cover the the whole screen. For this example let's think of them as "main" view and "menu" view.
Other than these two empty views, the view controller has no content. That's because this view controller does nothing other than manage other view controllers which get stuck into the two views. It will have a couple methods manage them, like presentInMainView:(UIViewController *)viewcontroller and presentInMenuView:(UIViewController *)viewcontroller
When the program starts running the master view controller will programmatically add the map to it's "main" view. The map view controller now cover the whole screen and looks and acts like it's the top level view controller, but it isn't. It's contained. At some point some taps the settings button and the map view controller will make a call to it's parent and say presentInMenuView:... and the master view controller will then load up a second view controller into the menu view. The menu view could even be located off the left side of the screen and the master view controller animates the menu view frame to side it right covering the whole screen. Assuming the menu view controller only has content which covers the left half of the screen you'll see the map view controller hiding behind it.
That really only scratches the surface, lots can be done with container view controllers. You could create a container which lets you brings up a dozen different views all populated with view different view controllers. You could size and arrange them on all over the screen and each child view controller could still only have to deal with it's own contents.
For more info there is the Apple Developer Guide and the WWDC 2011 Videos where it was introduced (session 102)
I used SWRevealViewController For similar type of sidebar animation.They given the good example of how to use SWRevealViewController also please try it once.

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"

iOS: How to get a modal view to partially cover the parent view?

I am quite new in iOS development and I am facing an issue with the design of navigation. So my goal is simple: I have a view with a right navigation button which I want to open a modal view that would partially cover the parent view like on this screenshot: modal view example
Currently this is what I did: I embedded a UIViewController in a UINavigationController, then I added a right navigation button in my view controller which navigates to another UIViewController through a modal action segue. But whenever I navigate to the modal view, it fully covers the parent view.
So how can I get it to only cover partially the parent view with Interface Builder settings? Or do I need to use some code behind to achieve that?
Thanks for your help :)
NB: I don't want to use Popovers, I want it to be in the middle of the screen with no attach.
To achieve this you have to select your segue and modify the Presentation property to Form Sheet, as shown in the image below

Resources