Is it possible in iOS 6 to know when a UIStoryboardSegue
has finished its transition? Like when i add a UIStoryboardSegue
from UIButton
to push another UIViewController
on the navigationcontroler, i want to to something right after the push-transition is finished.
相关问题
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
- Get the NSRange for the visible text after scroll
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Swift - hide pickerView after value selected
- Popover segue to static cell UITableView causes co
- How do you detect key up / key down events from a
- didBeginContact:(SKPhysicsContact *)contact not in
In case you don't want to use the
viewDidAppear:
method, you could create a custom segue. In theperform
method you would use an animation for the transition, and that can have a completion block. You can add the code there after the animation is complete.You can use - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
This method will be called right before a segue is performed in the source UIViewController. If you want to do some code in the destination UIViewController you can get the destination viewcontroller of segue.
You can also add this code in the viewdidAppear in the desintation viewController.
In Swift, from a
UIViewController
subclass you can get theUINavigationController
instance and set the delegate, in order to be informed about the completion of segues, as shown. Another logical place to track segues might be theAppDelegate
.Example of doing it from a view controller (VC for short):
But that only shows you when the segue to the VC is complete, as would
viewWillAppear()
orviewDidAppear()
delegate methods in the VC being presented; however, they don't inform about when the target VC is un-presented. It will also only work if your View Controller is part of a Navigation Controller stack.In the VC you're tracking, you could add the following to detect when the VC (and its memory) are deallocated, or override the
viewWillDisappear()
method.You can use the
UINavigationControllerDelegate
protocol and then define:you can call a method of destination UIViewController in prepareForSegue method.
here setHappiness method is of destination Controller and here 100 is passing there. so you can write a method in destination controller and call it here