segue

Passing data from modal segue to parent

亡梦爱人 提交于 2019-11-29 01:30:48
问题 I want to pass data (e.g. set var) from modal segue to parent, how can I do that? I’m using that code to exit from modal segue: @IBAction func doneClicked(sender: AnyObject) { self.dismissViewControllerAnimated(true, completion: nil) } I can’t use segue.destinationViewController here to pass data as i’m used to do on push segues. 回答1: Create protocol on Modal ViewController protocol ModalViewControllerDelegate { func sendValue(var value : NSString) } Also declare in you Modal ViewController

Passing variables between View Controllers using a segue

假如想象 提交于 2019-11-29 00:55:20
问题 I use Swift and Xcode 6 and would like to pass a variable from one View Controller to another using a Segue. I have created a segue called 'MainToTimer' which is trigger once button is pressed. I would like to be able to use the variable called 'Duration' on the second View Controller. Is it possible to pass multiple variables and constants? What code do I need associated to each View Controller? Thank you in advance. 回答1: First, setup property/properties to hold your variables in your second

Custom Push Segue removes navigation bar and tab bar in story board

别说谁变了你拦得住时间么 提交于 2019-11-28 23:20:02
I have the following defined in a custom Segue, let us call it SegueX: @interface SegueX : UIStoryboardSegue @end @implementation SegueX - (void)perform { CATransition* transition = [CATransition animation]; transition.duration = 0.3; transition.type = kCATransitionFade; [[self.sourceViewController navigationController].view.layer addAnimation:transition forKey:kCATransition]; [[self.sourceViewController navigationController] pushViewController:[self destinationViewController] animated:NO]; } @end In my story board I have just changed a standard Push segue to SegueX. For some reason this will

Unwind segue from navigation back button in Swift

帅比萌擦擦* 提交于 2019-11-28 21:23:40
I have a settings screen, in that I have a table cell. By clicking on that I take to another screen where user can choose an option and I want it back in the previous view controller when back button is pressed. I can put a custom bar button item, but I want to return to the parent view controller using the back button in the navigation bar rather than with a custom button on the view. I don't seem to be able to override the navigation back button to point it down to my unwind segue action and since the back button doesn't appear on the storyboard, I cant drag the green Exit button to it Is it

Unwind segue with Navigation back button

风流意气都作罢 提交于 2019-11-28 20:12:22
I have watched the apple demo video on storyboard implementation with the unwind segues section and seen the demo using custom buttons on the main view. That works fine. I have also seen a good example of the same thing here which works also. http://www.techotopia.com/index.php/Using_Xcode_Storyboarding_%28iOS_6%29#Unwinding_Storyboard_Segues However, I wish to have a normal push segue passing from parent (with main form data) to child (with advanced settings options) and then return to the parent view controller using the back button in the navigation bar rather than with a custom button on

Proper way to do “conditional segue” in iOS5

拈花ヽ惹草 提交于 2019-11-28 19:32:17
I'm trying to write really simple iOS5 app just searching for specific type of data. It contains two screens, the user puts some data in the first, the app checks the data and if it is valid, the app will do a search and show result on new screen. I'm completely new to iOS and storyboards, I read quite a few tutorials, but haven't been able to figure out how to do the checking of input and switching to new screen properly. With iOS5 I guess I should use segue but that's all automatic. Even though I can put some code in prepareForSegue method, I couldn't find a way how to stop the segue from

Is it possible to perform a Popover Segue manually (from dynamic UITableView cell)?

混江龙づ霸主 提交于 2019-11-28 19:11:29
I need to perform a Popover segue when user touches a cell in a dynamic TableView. But when I try to do this with this code: - (void)tableView:(UITableView *)tableview didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [self performSegueWithIdentifier:@"toThePopover" sender:[tableView cellForRowAtIndexPath]]; //... } than I get an error: Illegal Configuration Popover segue with no anchor Is there any way to do this (to perform a popover segue from dynamic TableView manually)? I was faced with this same issue tonight, there a couple workarounds (including presenting the popover the old

Segue from one storyboard to a different storyboard?

放肆的年华 提交于 2019-11-28 18:41:32
I have too many views on one storyboard which is causing it to run really slow. I have been told that a solution to this issue would be to split the one storyboard into multiple storyboards. Could anyone tell me how I can segue from a view on storyboard 1 to a view in storyboard 2 via a button? With Xcode 7 you can pick Storyboard References and set the destination storyboard and controller metamorph2 In Swift (iOS 8.1) this is pretty easy : var storyboard: UIStoryboard = UIStoryboard(name: "Another", bundle: nil) var vc = storyboard.instantiateViewControllerWithIdentifier("NextViewController"

Reversal of Custom Segue with Storyboarding

核能气质少年 提交于 2019-11-28 17:19:14
I have a custom segue animation that occurs when pushing a new view controller onto the stack. When popping the view controller that was presented with said custom segue, however, the default navigation controller animation happens (that is, the current view controller animates to the right while the parent view controller translates on-screen from the left edge). So my question is this: is there a way to write a custom pop segue animation which happens when popping a view controller off the stack? Edit (solution): I ended up defining a custom segue similar to the selected answer. In the

Swift pass data through navigation controller

江枫思渺然 提交于 2019-11-28 16:10:20
One of my segues transitions from a view controller to a tableview controller. I want to pass an array between the two, but with a navigation controller before the tableview controller, I can't figure out how to pass the array. How do you pass data through a navigatiom controller to a tableview controller? Tommy Devoy Override prepareForSegue and set whatever value on the tableview you'd like. You can grab the tableview from the UINavigation viewControllers property. override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!){ let navVC = segue.destinationViewController as