segue

(Swift) PrepareForSegue: fatal error: unexpectedly found nil while unwrapping an Optional value

邮差的信 提交于 2019-11-27 18:12:57
问题 DetailViewController: @IBOutlet var selectedBundesland: UILabel! TableViewController: override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) { if (segue.identifier == "BackToCalculator") { var vc:FirstViewController = segue.destinationViewController as FirstViewController vc.selectedBundesland.text = "Test" } IBOutlet is connected! Error: fatal error: unexpectedly found nil while unwrapping an Optional value I read multiple pages about Optionals but i didn't know the

To stop segue and show alert

此生再无相见时 提交于 2019-11-27 17:59:09
Using iOS 5 storyboards, on a button I am performing a segue, what I want is to do validation on my textfield and if validation is failed I have to stop segue and throw an alert. Whats the way to do it? If your deployment target is iOS 6.0 or later You can simply implement the shouldPerformSegueWithIdentifier:sender: method on your source view controller. Make this method return YES if you want to perform the segue, or NO if you don't. If your deployment target is earlier than iOS 6.0 You will need to change the way your segue is connected in the storyboard and write a little more code. First,

Push segue in xcode with no animation

坚强是说给别人听的谎言 提交于 2019-11-27 17:39:46
I am using normal storyboarding and push segues in xcode, but I want to have segues that just appear the next view, not slide the next view (as in when you use a tab bar and the next view just appears). Is there a nice simple way to have normal push segues just "appear" and not "slide", without needing to add custom segues? Everything is working completely fine, I just want to remove that slide animation between the views. I was able to do this by creating a custom segue (based on this link ). Create a new segue class (see below). Open your Storyboard and select the segue. Set the class to

Dragging onto the exit of the viewcontroller not working

余生颓废 提交于 2019-11-27 16:49:51
问题 I have looked for this problem everywhere. I know how the unwind scene works. I have implemented the following code in the A VC -(IBAction)returned:(UIStoryboardSegue *)segue { try.text = @"Returned from Scene 1"; } But when I go to my B VC(Which is the VC I want to go back to A VC from) and ctrl drag a button onto the exit at the bottom it will not allow me to. And no function pops up in the exits option. Anyone else had this issue or can help? 回答1: To set up an unwind segue, you should Set

How to dismiss the current ViewController and go to another View in Swift

只谈情不闲聊 提交于 2019-11-27 15:59:37
问题 I am new to Swift and I want to know how to dismiss the current view controller and go to another view. My storyboard is like the following: MainMenuView -> GameViewController -> GameOverView. I want to dismiss the GameViewController to go to the GameOverView, not to the MainMenuView. I use the following code in my MainMenuView: @IBAction func StartButton(sender: UIButton) { let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil) let nextViewController = storyBoard

Swift 2 to 3 Migration for prepareForSegue [duplicate]

拥有回忆 提交于 2019-11-27 15:53:01
This question already has an answer here: prepare(for segue: UIStoryboardSegue, sender: AnyObject?) missing in swift 3.0/Xcode 8 b6 1 answer This question might have been answered already but I could not find it. override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { } This code worked fine in swift 2 but now gives me an error to remove the override. Exact Error: "Method does not override any method from its superclass" What is the new correct method for swift 3 for this? I can't seem to find any documentation on it anywhere. Method signature is changed in swift 3.0

Perform segue after Login successful in Storyboards

感情迁移 提交于 2019-11-27 15:24:35
I have 2 UITextFields , one of them for Login and the another for the Password. Only if the Login is "succesful", I want to perform the Segue with Push to another View Controller . But when I touch the button, directly the View push to the Another View without check the Condition. In StoryBoard I drag from the UIButton to the View Controller I want to push, for creating the segue with push option. Here is my code: - (IBAction)buttonLogin:(id)sender { if (([self.textFieldLogin.text isEqualToString:@"User"]) && ([self.textFieldPassword.text isEqualToString:@"1515"])){ [self

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

两盒软妹~` 提交于 2019-11-27 14:43:26
问题 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]; }

What are Anchor and Passthrough used for in popover segues?

你说的曾经没有我的故事 提交于 2019-11-27 14:26:38
问题 In Xcode, a Popover segue has two connection fields named Anchor and Passthrough. What are they used for? 回答1: These are properties of the UIPopoverController , not the segue. Thats why if you look at the documentation for the UIStoryboardPopoverSegue , you won't find these two properties. The anchor is telling the UIPopoverController where to point its arrow. The passthrough is an array of views that the user can interact with while the UIPopoverController is displayed. The documentation is

Pass data between ViewController and ContainerViewController

隐身守侯 提交于 2019-11-27 14:22:06
I'm working on an app, and need to pass data between view and containerView. I need to send data and receive data from both Views. Let me explain better: I can change the Label Master (Touch the Container Button) by protocol , but I can not change the Label Container (Touch the Master button). What happens is the Master connects with the container by a following. But do not have a follow Container linking to the Master. I tried to add but segue to, but it worked. The Master View Controller: import UIKit protocol MasterToContainer { func changeLabel(text:String) } class Master: UIViewController