All I am working on a legacy code that does the following
creates a child view controller and add's it to the parent controller
The child view controller is presented in the parent VC. So the animation starts from bottom towards the top, but only up to a specific location, leaving a height of 100 from the top.
So I have a superview being displayed within the bounds (0,0), to (SCREEN_WIDTH, 0) and (0, 100) and (SCREEN_WIDTH, 100)
The child view controller view is displayed below it.
If you tap on any part of the screen that is a part of the parent view, you can swipe and up down, causing it to scroll. I don't want that. How do I disable scrolling of the superview when the child view is loaded?
I have tried the following solutions.
Create a delegate protocol that parent VC implements to try to set the content off set to CGPointZero. This delegate is called from the child view.
Create a delegate protocol that parent VC implements and call the following function from the parent VC (which has a custom UIScrollView) that executes the following
self.view.scrollEnabled=NO;
This option did not work for me either. Is there any other way for me to do this?
Present a child view controllers view fully with clear color . Inside that view make a subview by doing like this " but only up to a specific location, leaving a height of 100 from the top." so nothing is touchable from the parent's view. Or do what ever your doing ,but when child is about to present disable parent controller view with user interaction enable to 'NO' or cover it with clear color view.When child is diss missed enable the parent controllers view or remove that cover view.
Related
I have a navigation controller with its root view controller, I need to add a fixed/ sticky view at the top of the root view controller, so that only the content below it navigates whenever I use pushViewController or popViewController, is that possible?
Look at the image below, I want the red area to be fixed/sticky a.k.a doesn't navigate or move when I push or pop, only the blue area to navigate
P.S: The containerView won't work here as it acts as normal view, and adds its sub view controller's view to it.
Add a container View to add as child view controller for your navigation and set navigationBar as hidden. Now you can add the above view with 44 height as a sticky one for all View controllers.
If you want a way to communicate between child view controllers under navagtion with the parent I would suggest NSNotification observer or a Delegation to be confirmed by all child VC or by a subclass of UINavigationController.
This is a sytematic way.
Other dummy way is to add a view to the window and set the view.layer.zPosition if you want it below or above any other view.
you can use Container View and show/hide other views
I am using UIPageControl as indicator between different page (view controllers) of my application. In each of the view controllers, I need to have a different button on the left corner on the UIPageControl. If I place a UIButton at that position on each of the view controllers, I see it on the UIPageControl but the buttons do not respond to the touch event. Is there something I am missing? Or is there an alternative to do this? Thanks.
I guess the page control and the view controller view are both subviews of the same view. In this case, the button is drawn outside of the view controllers view bounds. This is allowed by default, but it does have the side effect that the button can't be tapped on as the superview doesn't handle the touch.
You should have the buttons on the page control owned by the 'super' view controller (the controller that owns the root view containing the page control and the child view controllers). Then, when a button is tapped it should tell the child view controller about it so that it can take the appropriate action.
While adding a child view controller, is there a way to hide parent VC elements from the voiceover access?
I've a parent view controller P, which adds a child view controller C as a full screen page view controller. Once the transition to the full screen finishes, the voiceover still goes through the elements in the parent view controller.
Any idea how I can hide/disable accessibility of elements in the parent view controller?
You can set accessibilityViewIsModal on the occluding view. Note that the view is made modal relative to sibling views, not globally. If you need to hide views in parallel view hierarchies from the accessibility hierarchy, consider toggling accessibilityElementsHidden.
Just getting started with iOS, and trying to make the collection view on the right be a child view of the view on the left. I cant seem to drag it in. I think part of the problem is that on the left hand part of the nav (immediate left of the work area) the collection view is being called a scene. To create the view into which I want to put the collection view, I just dragged a new view controller into the work area, then did the control+click to add it to the main tab view. I am going to want another view above the collection view, but first things first...
Do I have to do this programmatically?
UICollectionView inherent from UIScrollView:UIView, so you can add in your IB or in code:
Like tableView, drag delegate and datasource to ViewController.If you want more collectiotionView, create more flowlayouts.
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.