Close a Page Sheet VC through pulling in down - swift

I'm trying to close a VC on a special way.
As the title says I want it to be covered vertical but not from down to top, but the other way.
i tried all things I found but non of them helped. I´m using Navigation controllers and if I pull the VC with my finger down it works, but if I use my back Btn it covers from bottom to top.
Currently the button code is pretty simple:
self.performSegue(withIdentifier: "BackToFriends", sender: nil)
Where do I have to define In which way it closes?
Thanks for every help

Ups it´s really simple.
Just using self.dismiss(animated: true) and that´s it

Related

How to segue to previous screen using Swift without losing data in swift 4

I have a button from my create account page that opens up another view controller that has some information in it.
i move it by doing a segue:
self.performSegue(withIdentifier: "sugueToRules", sender: self)
on my other Viewcontroller i have a back button that connects form the storyboard, to the create account one (the precious one)
when i go back i lose all my data that i put on the create account,
so i must open a new instance of it.
how do i keep all my data of it when i go back ?
do i have to save a local file somewhere and load it when i come back ?
i'm using swift 4
Make sure that they are managed by a UINavigationController. Then the back button will do its job just fine (no need for you to 'wire' something -- this is the default behaviour). Right now it appears that you are allocating a new controller each time you go back.
The same applies to a modally presented controller (with a custom close button for example), although you have to dismiss (or use an exit segue) instead of firing up a segue pointing back.
Passing segue to previous screen will creates a new instance of the previous viewcontroller. It it better to be bound in navigation controller and popout the presented screen using when back navigation is not required.
self.navigationController?.popViewController(animated: true)
self.dismiss(animated: true, completion: nil)
you need to use UINavigationController for navigating UIViewController like -

View in Viewcontroller disappears

Having a bug when i try to delete viewcontroller2 which is connected to vc1. Part of the view in viewcontroller1 seems to disappear even though i remove all connections. Ran in to this problem before on same project when connections were not right.
The first image is how it is supposed to be with listname and a button in lower corner.
The last image is how the tableview looks like when i try to remove the other vc.
Any idea of how to solve this?
I don't know if this is what you want but try putting this in the function for when vc2 closes:
self.navigationController?.popViewController(animated: false)
dismiss(animated: false, completion: nil)
self.view.removeFromSuperview()
self.view = nil
If you provide some code it will be easier to understand.

Segue from a SLPagingViewSwift VC and dismiss the destination VC to return

***** You can download this project to see the issue *****
I've embedded SLPagingViewSwift in my project.
In the third VC i added a button (and a table):
The button configured to do a segue (Present Modally):
In the target VC i have a button (marked in square green above) that do:
#IBAction func dissmissIt(_ sender: AnyObject) {
dismiss(animated: true, completion: nil)
}
But after the target VC is dismissed i see the button in the third VC in a different location (higher):
The layout is configured, button 40 pixels from the top (and table 8 pixels from the button):
What went wrong?
I guess the initial layout configuration takes the SLPagingViewSwift navigation bar into consideration but after the dismiss it recalculates the layout from the top of the screen.
What is the right way to perform the segue and dismiss the target VC while keeping the layout as designed?
I saw this answer
But i was not sure where to use it. i tried:
nav?.view.translatesAutoresizingMaskIntoConstraints = false
and
controller.view.translatesAutoresizingMaskIntoConstraints = false
But with no luck.
***** You can download this project to see the issue *****
Thanks.
I had the same problem. After a lot of hour trying to fix it, I found the solution.
Click on your segue
On the right panel click on 'Show the attributes inspector'
Set the Presentation option to 'Over Full Screen'.
Worked for me. I hope it works for you!

Navigate through views in storyboard xcode

I'm using segue show to navigate from a view to another. I'm using
self.performSegueWithIdentifier("Nextview", sender: self)
to navigate around, but i don't quite understand this functionality. Does this make a new instance of view - if yes, does the old view get dialoged/deleted? Another thing is should i use the same method when i want to navigate back?
self.performSegueWithIdentifier("PreviousView", sender: self)
if not, what should i do to navigate back? Hope you guys can help

How to return from "partial curl" type segue

I am attempting to use a partial curl segue to reveal an options view underneath my main view. This is identical to touching the "page curl" button in the bottom right corner of the Maps app.
I can successfully execute the segue to the option view, my problem is returning to the main view. I'm hoping to replicate the reverse animation effect of the Maps app as the edge curls back flat and the main view is shown.
It doesn't seem logical to create another segue to return back to the main view (what I would do if I were not using the partial curl segue) because the return segue is associated with the original segue.
Thanks in advance for any help!
try
-(IBAction) buttonPressed{
[self dismissModalViewControllerAnimated:YES];
}
This should work!
Or i believe you can press the back side of the turned page and it will return automatically with out adding any code! Hope that helps!
In Swift dismissModalViewControllerAnimated has been renamed:
#IBAction func handleAddButton(_ sender: Any) {
self.dismiss(animated:true, completion: {})
}