In my application I have a main view vontroller which has another view controller, flipsideViewController, behind it. Upon pressing a button in the main view, it curls up and the user has access to the other view behind it.
Within the flipside view, there is a button which is supposed to switch the view to a third view controller. However, the third view comes up behind the main view and it is supposed take up the entire screen.
A Page curl is not ment to show the entire screen, it is only ment for half or 3/4 of the screen, like in the Maps.app. If you are looking to change it, i suggest using the "Flip Horizontal" animation in this case.
Related
I want to implement the following: big circular material-style floating button (aka MDCFloatingButton) flying in the right bottom corner of the screen, and by tapping it the user can switch views beneath it. Moreover, these views should be controlled by different ViewControllers.
Is it possible? If it is, please explain how these components should be organized.
Thank you!
You can create a view controller that has the floating button and a container view. That container view has it's own view controller. So maybe that container view controller can be a UIPageController and you can change view controllers tapping the button, but the viewcontroller with the floating button will never leave screen. You are just changing what the container view shows.
Apple docs
I am trying to create a two ViewController solution where a modal view controller is presented over a UICollectionView while allowing the user to interact with the CollectionView. In this case, it is like an advanced picker, allowing the user to choose items that will populate the properties in the modal view before saving a record.
I have a presentation controller setup to present the view how and where I want, allowing full visibility to the parent view. Nothing I have tried will allow the user to interact with (scroll, tap, etc) the UIController view.
In view debugging, I see a UITransitionView that has a frame equal to the full screen. (see image) I suspect that this is the culprit. Is this even possible in iOS?
The whole point of a modal view controller is that it takes over the screen and demands that the user respond to it before doing anything else. It puts your program into a "mode" that must be dismissed before the user can go on. That is the core reason for being of a modal dialog.
If you can interact with the view controller underneath the the top view controller is no longer a modal.
What you are trying to do is wrong from a human interface standpoint, and not supported by the application framework. You need to rethink your design.
Edit:
Top-level view controllers are not designed to share the screen. If you want another view controller to cover part of the screen while the user can still interact with the view controller underneath then you should use a container view as #МаксудДаудов suggests in his answer.
I would probably put a container view on top of the rest of my view controller's content, control-drag an embed segue to the child view controller I want to display, add an outlet to the container view, and then hide the container view.
When you want to display the "picker", you could then un-hide the container view, which would reveal the child view inside and let the user interact with it, while still being able to interact with the other components in your main view controller.
There is no way allowing presented full screen view controller to interact view controller under that. Instead , add your second view controller at containercontroller at some part of first, and change first VCs collection view frame accordingly, to be able see all the list. Doing this, you will have two view controllers working together
I'm programmatically presenting a view ontop of my main view controller's view. On the view I'm programmatically presenting there are buttons. The problem comes when I tap on one of these buttons, I'm interacting with the view I've presented my view overtop of. For example, I've got some buttons behind the view I'm presenting, and if I tap in the view where the covered up buttons are, the code still is getting run for the buttons behind the view even though they're hidden behind.
The only way I can think to stop this is to add tags to each of the views within my presented view and then do some logic like "while I'm presenting this view, go through all of the subviews on the main VC, and if those tags don't equal any of the tags in the presented view, turn off user interaction"
It seems super common to present a view overtop of other buttons/views. Is there a better way to accomplish this?
Turn on User Interaction Enabled for the covering view. Now touches cannot fall through to the covered buttons behind it.
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.
Is there any way to have a static graphic on screen that doesn't move when pushing / popping view controllers?
The best way I can think to describe this is like a tab bar.
If you have a tab on a tab bar that has multiple pages that swipe left/right, you can view these different pages, and only the main content area moves, while the tab bar stays fixed and doesn't swipe in/out along with the content.
I want to do something similar with a custom toolbar I have created and added to a view, but just now it slides out with the previous viewcontroller and then slides in with the new view controller.
Is there any way to keep that fixed on the screen so that it doesn't move.
Hope that makes sense!
Yes, you can do this using container view.
It is fairly new to XCode, so it doesn't have the widespread use that navigation controllers and tab bars do, but it works similarly.
Basically, You will create a new UIViewController instance in storyboard, and put a Container View inside the view controller, filling the entire view controller. From there, you will right click on the view controller where your flow starts (probably either a tab bar controller or a navigation controller) select embed, and target the container view in your new view controller. Finally, you'll need to change the initial view controller (the arrow that points to the first view controller the app should load) to this new UIViewController that has your container view.
If you run your app at this point, you should notice no difference at all. The entire app is basically running inside the container view of that new view controller. Now, you can a UIImageView to that new view controller anywhere you want. Since the new view controller doesn't ever go away, the UIImageView you put inside it will stay there no matter what the container view is showing.
Hope this helps!
Note: I should add that if your program uses any modal transitions, that will cause the flow to exit the new view controller and it's container view as well, similar to how this affects tab bar controllers.