how to implement pushing functionality inside UIPageViewController - ios

In my project i have one pageviewcontroller it's manage three viewcontrollers. First viewcontroller is a tableviewcontroller second one is UIViewcontroller .By normally i can scroll the viewcontrollers using pageviewcontroller scrolling functionality. It's ok for me, but i need one more thing using pageviewcontroller when i select one row of tableviewcontroller i need to push (scroll)to second view controller. How can i do this using pageviewcontroller, after this i need to sroll back to firstviewcontroller.
please help me

Here is a page control on github link. This uses viewcontrollers for every page. Just use NavigationControllers instead of these viewcontrollers and set the desired view controllers as root View controller. You will be able to push and navigate through screens.

Related

Swift: Storyboard solution to clicking from ViewControllers to ViewController in a ContainerView

I am building a App with a fixed Top Bar and some fixed Buttons at the bottom. In the middle of my MainViewController I want to have some Tables I switch in between. The ways I want to do it:
clicking the buttons at the bottom
clicking buttons in my tables
To solve the problem I put a ContainerView inside my MainViewController. It works for me already to switch the InsideViewControllers by clicking one of the buttons at the bottom. I solved it with Apples Tutorial programmatically. By click on a button I change The childViewController of my ContainerView.
When clicking a button in my InsideViewController I am sending a message to my ParentViewController (the Container) right now. This I did by implementing a protocol and checking if my parentViewController implements it.
Now my question is if this is the optimal solution to click from ViewController to ViewController inside my ContainerView. Or is there a better way to click a button on my Table and get the next Table?
What I was thinking about is maybe possible:
A storyboard solution. I want to connect ViewControllers inside my storyboard. So that I have a button on my first view Controller and do a segue from this one to the next ViewController. If I do it just like explained the new ViewController is not filling the Container. There pops up a normal ViewController to my app. Here a example View of this idea:
Is it possible or do I continue by sending messages to my parent?
Sure you can. You can start reading Implementing a Container View Controller, specifically, the section "Configuring a Container in Interface Builder". At the initial phase of adding the Container View, you will automatically see a new UIViewController appearing there. I guess if you will want to perform transitions, you will have to Embed In a navigation controller that new view controller.

Segue from one ViewController to another ViewController inside a Tab Bar Controller?

In the interface builder I have a UITabBarController and it is set as the initial view controller. From the tab bar controller, I have linked three independent ViewControllers; two UIViewController's and one UITableViewController. I have embedded all three of these views inside UINavigationController's as each of these views will eventually segue to a new view.
Interface Builder
Problem:
I now want to link one of the UIViewController's to the UITableViewController using a button to segue to the table view. This way I can pass information, i.e. func prepareForSegue(), to the table view. I want to maintain the tab bar controller at the bottom, however I do not want to have the ability to go back to the previous UIViewController from the current UITableViewController via a UIBarButtonItem at the the top of the view; That is what the tab bar at the bottom is for.
However every time I segue "Show" the table view (it is actually a segue to the table views navigation controller), the navigation bars at the top and the bottom of the table view disappear. Is there anyway to prevent this from happening?
I have also tried segue "Show" directly to the table view, in which case the tab bar is visible, but then it displays a "back" button at the top of the view to segue back to the sending UIViewController. I am hesitant about accepting a solution that would just hide the back button, because I feel I will run into problems down the road when I want to navigate to a detail view from the table view itself, since I would be bypassing the UITableViewController's UINavigationController.
Any solutions would be greatly appreciated. I have been trying to solve this problem for hours and I'm about to put my head through my computer screen. Also I thought about just using tabBarController?.selectedIndex on the button click to shift to the table view, and then passing the information using NSUserDefaults, but this is out of the question since I would be passing a custom object, and would have to encode and decode every custom field.
I you use a segue to get to it, as you say, you will still be using the UIViewController's UINavigationController which seems a bit messy. So I actually think selectedIndex is probably the best way to go as once you change to the UITableViewController you'll be in the correct navigation stack.
Instead of using NSUserDefaults, why not just reference the UITableView itself from the UIViewController, set the values you want, and then swap to it using self.tabBarController.selectedIndex.
So for your scenario above it, assuming the UITableViewContollrer is the third view in the UITabBarController, you would do something like the following:
Pass whatever you want into the UITabBarController by setting some pre-defined var in it. For example, if there was a String called saveMe in the UITableViewController, then do the following in the UIViewController:
let navController = self.tabBarController?.viewControllers![2] as! UINavigationController
let tableViewController = navController.viewControllers.first as! JarListTableViewController
tableViewController.saveMe = "Saved string here"
Swap to the UITableViewController using:
self.tabBarController?.selectedIndex = 2
The only issue with this is using selectedIndex won't perform a transition animation but not sure if you need this. This link could help if you do.

Overlapping UIViewController with another UIViewController Using Swift Programmaticaly

I have this problem and I can't seem to find the answer so I asked here. I need to overlap 2 UIViewControllers. It is in a navigation controller. Each Controllers is using xib files as view since I am not using storyboard. It needs to be overlapped since the first controller is on live feed and I cannot afford to use a screenshot for background to make the live feed stay on while the user is navigating on the second controller. Any Ideas?
try content views doc tutorial
and the VC which you want to overlap, you will not keep it in you navigation stack, you will have to make overlapping VC, child of the VC on which you want to present it, after making child you will add child VC's view as a subview to parent's view. in that way both view controllers will appear to be overlapping

Set RootViewController in UIViewController

Currently i working on iOS App and my requirement is to set TabbarController as a root view controller in all the upcoming features ViewController. so anyone can please suggest me how it possible ?
This my TabBarController
and this was Viewcontroller for Edit Profile which is outside viewcontroller means not in mention 5 tabs viewcontroller.so i wanted to to Display in bottom of controller TabbarViewController as a root viewcontroller.
OK, that's simple.
First, you should embed in a UINavigationController to your Middle View Controller.
Then, you can push Edit Table View Controller when press edit button
Here is an overview :
I only add two controller into tabbarController you can add five controllers.

Combining Navigation with Controller to PageViewController

I am using a PageViewController to manage a series of viewControllers which all use a tableview. As the following picture depicts the PageViewController is a container controller for the PageContentViewControllers
After clicking on a tableCell I would like the app to navigate to a detailed view. From what I have read, the proper way to do this is by using a navigationController which is also a container controller.
Through storyboard I have tried putting the NavigationController at both the PageViewController and the PageContentViewController and neither seems to work correctly, I am not sure what other approach I am take.
What is the proper way to combine a PageViewController with a NavigationController if they are both container controllers?
Depending on how you want to structure your app:
Embed your PageViewController in a Navigation Controller (select the PageViewController in storyboard and choose Editor > Embed In > Navigation Controller)
Embed the new Navigation Controller in a Container View within a super controller.

Resources