Segue from a scrollview - ios

I have a UIscrollview that takes up about half of a screen. The scrollview contains a series of view controllers that have buttons that have segues to another view controller. When that segue is followed, it loads the view controller on top of the current scrollview.
I want that new view controller to act like any other modal segue would act if the button was not within a subview or scrollview. In other words, take up the whole screen.
Can you use segues from within a subview or a scrollview?
Thanks!

The scrollview contains a series of view controllers that have buttons
that have segues to another view controller.
An instance of UIScrollView can't "contain" view controllers -- it can only contain other views. It might contain views that are managed by other view controllers, but if you're using many view controllers all at the same time you may want to read Am I abusing UIViewController Subclassing?.

I ended up just using delegates and protocols between the views in the scrollview and the parent view controller and then I launch the new view from the parent view controller. Seems to be doing the trick.

Related

Can I use storyboard to embed UINavigationController's view inside a UIViewController?

I want to keep the top and bottom sections of my view stationary and I only want to add a navigation controller at the center of the screen.
This has been perfectly doable for a lot of years and now as everyone is so enchanted by the Storyboards, I wanted to do the same through the storyboard and it seems like it is impossible.
Is it possible anyways?
you can use Container View in the storyboard.
Container View defines a region within a view controller's view
subgraph that can include a child view controller. Create an embed
segue from the container view to the child view controller in the
storyboard.

ContainerView nextViewController is not child stacked to container view as subview

I have 3 View Contorller
First View controller have Container View of height 300.0f at the center.
It has one embedded view Controller which is table View controller.
On cell selection it should navigate to detailsViewController.
All the process is ok.
But detailsViewController is not behaving as embedded view controller of containerView and not of same size as container view.
It takes whole screen size.
As it is triggered from the embedded View Controller it should follow that frame without overlapping other controls which are in First View Controller.
You need to embed not view controller with table view, but embed navigationController(you can hide navigation panel on up side), end set yours table view controller as root for it, and use pushViewController to go to detail page.
hope ganesh this will help you
Look You have a Container View inside it you have a tableView and By clicking an cell you pushing another viewController that what i concluded after reading your question(hope you done everything in modular way).
Now you must have UIView subclass(i.e separately creating a view class ) inside which you have a tableView so you pushing by
[self.nav pushViewController:sos animated:YES];
there are two way to push ViewController inside a view first by Callback(through blocks) or passing Navigation ref. in UIView Class .So you are pushing the new Controller over the navigation thats why it showing this behavior and which is obvious.

How do you change a master view controller from UITableViewController to UIViewController in a storyboard

I was wondering if it is possible to change the master view controller in a split view controller from UITableView to UIViewController in a storyboard. I am looking for a way to make the master view contain regular non scrolling controls on the top and left sides with a scrollable table view talking up the rest of the view space.
Delete the table view controller (and the navigation controller if you want), drag out a UIView controller, and hook it up (control drag) either to the split view controller or the navigation controller, if you're using that.

iOS: Displaying views of other viewcontrollers

So if there is a UIScrollView which should display a number of different views I'm used to creating them as different view controllers, and hooking them up in IB.
After I import them in the main view controller I add the views of the separate view controllers onto the scrollview as a subview.
Is this a good (safe) approach?
If the main view controller (owner of the scrollview) deallocates will it take care of the other instantiated viewcontrollers whose views are displayed in the scrollview?
Or should I call nil on all the separate VCs in the main VC's dealloc or viewDidDisappear?

What is the correct way to handle multiple view controllers on the same screen?

I'm having a view controller, that has few controls and images, and is located on top of the screen. I will have a space below it for child view controllers and their views.
I will show one child view controller at a time, what is a good way to do that?
Total amount of child view controllers is around 6, they are very different, so reusing some container view controller won't really work.
When pressing some button on these controllers I will move to next one.
Should I make some property, let's say contentView that will hold a view of the controller that is currently on screen?
How do I handle rotation if I don't use auto layout?
EDIT: This is more a theory question, I know of methods addChildViewController and know the way how I add views and controllers to their parents. I just want to know the good way to do that.
It depends somewhat on how you want to transition between the different child view controllers, but your question already lists a good approach.
You definitely want a different view controller for each of the children. Add a container view to your top level view. This view is where rotation and auto-resizing are handled. The contents of this view could be the child view controllers views themselves (and you control the transitions using one of the methods like transitionFromView:toView:duration:options:completion:) or the container view could hold a UINavigationController and you just push the child view controllers into it.
Whatever the container view holds, you need to take care if any of your child view controllers tries to present another view controller as a modal. The presented view controller needs to be presented by the view controller at the top of the hierarchy or the presented view may no interact correctly or truly be presented in front of other screen elements.

Resources