I would like to add a close button outside the bounds of the modal view controller which I am presenting on an iPad app.
I tried adding a button normally via storyboard, via coding, but the UIButtons view gets clipped by the bounds of the modal view controller.
What my purpose is : I want to add a close button at the right corner of my modal view controller which is configured as a Form sheet.
I'm launching the modal view controller via a segue from my previous view.
Attached screenshot show what I am trying to achieve:
Related
The goal is to achieve exactly the same effect as creating a new email message in the the Mail app on iOS.
When clicking on the "Compose" button at the right bottom corner of the Mail app, the present view controller fades slightly in the background and a new view controller is loaded partially on top of it. The old view controller can be still perceived at the top of the screen. The Fantastical app does it as well when clicking on the "+" button at the top right corner.
You can add it into your current view controller as a child view controller.
// Parent View Controller
//...
let childController = ChildController()
addChildViewController(childController)
// add the child controller's view in, reframe it, animate it here
addSubview(childController.view)
// To remove the controller
childController.removeFromParentViewController()
I'm working on an iPad app using splitview controller and MVVMCross which requires a login screen. I'd like the login screen to appear as a modal popover in the centre of the screen, over the top of the underlying screen which is controlled by a UISplitViewController.Ideally I'd like the 'master' view to be hidden and then appear after a successful login. I understand my UISplitViewController has to be the root controller, so I need to launch the popover from either the master or detail view at an appropriate event
General iOS modal views:
When doing modal views, I tend to do something like this inside the view that we want to be the parent of the modal view.
var myViewController = new UIViewController();
var myModalNavigation= new UINavigationController(myViewController)
{
ModalPresentationStyle = UIModalPresentationStyle.FormSheet,
ModalTransitionStyle = UIModalTransitionStyle.CoverVertical
}
this.PresentModalViewOnTop(myModalNavigation);
We create our view controller, then a navigation controller using the view controller. We give the nav controller a modal presentation and transition style. Then inside the view controller that will launch the modal view we call this.PresentModalViewOnTop();.
In your case in particular, you'd probably want to do this code from your "master view". But you can make it do that inside ViewDidLoad to ensure they can't use your "master view" until the modal has been satisfied and disappeared.
Modal views in MvvmCross:
You'll need to change your presenter logic as MvvmCross assumes every view model is just a normal full "page". There is a great explanation of how to do this here: How do I specify a view to be pushed as Modal in MvvmCross?
I don't know how to do this. I have a view created in Storyboard containing a picker wheel and slightly below a button.
Now if the user clicks a button in my view controller I want this "view container" slided in from the top and as soon as this button (within this view container) is clicked, the view should slide out to the top again. But how can I do this? As said I created this view container completely in my storyboard over my main view controller but don't know how to program this and also not what to do with the vertical constraints?
You want this view to be managed by a view controller. When the button is tapped, you call the view controller with a down animation. When the button under the picker wheel is tapped, you dismiss the view controller with a top animation.
Here is my current problem. I have a UIViewController setup with its data and everything on a small sized view controller. What I am trying to see is if it is possible to connect that to a separate view controller. For example I have a view controller that has a user click a button. Upon pressing the button the UIPicker ViewController would pop up from the bottom and I could go from there. I know how to enable this if the picker is on the same view controller. However, I have no idea how to if its on its own ViewController. Any ideas?
One way to do this would be to put the picker view on the same view controller and make it hidden, and, when they press the button, unhide it or load the other view controller when they press the button; this will display the other view controller, not what's on the current one.
I made a xib file, but all I can get is either iPad or iPhone view. How can I make it so that the size is the same as a modal view form sheet?
If you drag a view onto the Storyboard and connect it with a modal segue, then click on the segue and set it as form sheet style, it will automatically resize the viewController. Then, in the view that's presenting the modal view, implement -prepareForSegue.