segue

To stop segue and show alert

百般思念 提交于 2019-11-26 19:17:50
问题 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? 回答1: 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

Perform segue after Login successful in Storyboards

偶尔善良 提交于 2019-11-26 18:29:59
问题 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

Segue in SKScene to UIViewController

喜夏-厌秋 提交于 2019-11-26 17:43:07
问题 In my GameScene.swift file, I am trying to perform a segue back to my Menu View Controller like so: func returnToMainMenu(){ var vc: UIViewController = UIViewController() vc = self.view!.window!.rootViewController! vc.performSegueWithIdentifier("menu", sender: vc) } This method is run when a node is tapped: override func touchesEnded(touches: NSSet, withEvent event: UIEvent) { for touch: AnyObject in touches { let location = touch.locationInNode(self) if gameOn == false{ if restartBack

Swift 2 to 3 Migration for prepareForSegue [duplicate]

北城余情 提交于 2019-11-26 17:20:38
问题 This question already has an answer here : prepare(for segue: UIStoryboardSegue, sender: AnyObject?) missing in swift 3.0/Xcode 8 b6 (1 answer) Closed 3 years ago . 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

Pass data between ViewController and ContainerViewController

半腔热情 提交于 2019-11-26 16:43:07
问题 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:

How do I perform an auto-segue in Xcode 6 using Swift?

风格不统一 提交于 2019-11-26 16:37:40
问题 I wish to auto-segue from the main viewController to a second view controller after a set period of time after an app loads. How do I do this? Do I need to do it programmatically? 回答1: If your UI is laid out in a Storyboard, you can set an NSTimer in viewDidLoad of your first ViewController and then call performSegueWIthIdentifier when the timer fires: class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view,

Understanding performSegueWithIdentifier

孤街浪徒 提交于 2019-11-26 16:07:48
Can someone more knowledgeable than I explain performSegueWithIdentifier:sender: for me? I need to switch views (and classes) and also carry a few NSStrings and IDs over to that view's class. I was wondering if this is possible with performSegueWithIdentifier:sender: Thanks! jrturton First, you have to have set up the segue in your storyboard and give it the appropriate identifier . (Click on the segue (left panel) and then click on Attributes (right panel). You can then link this to buttons or selection of table rows from your storyboard, or you can call it in code using

IOS7, Segue and storyboards - How to create without a button?

我只是一个虾纸丫 提交于 2019-11-26 16:07:24
I currently have a login View and an Application view, I have successfully implemented validation on the login view and I need to programmatically shift to the application view on successful validation. I understand I can add a segue to the login button and then call it programmatically like so... [self performSegueWithIdentifier:@"LoginSegue" sender:sender]; But this will obviously be triggered whenever the button is clicked (As the segue was created attached to the button). I've just read that I should create a button (And hide it) and then make a programmatic call to the segue - this seems

DestinationViewController Segue and UINavigationController swift

杀马特。学长 韩版系。学妹 提交于 2019-11-26 15:46:37
问题 So I have a prepareForSegue method like this: override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "fromEventTableToAddEvent" { let addEventViewController: AddEventViewController = segue.destinationViewController as! AddEventViewController addEventViewController.newTagArray = newTagArray } } However, at runtime the app crashes and logs spit out this message: Could not cast value of type 'UINavigationController' The error comes because the

Passing data between View Controllers using Segue

雨燕双飞 提交于 2019-11-26 15:25:18
I am new to iOS. I am facing a problem passing the data between ViewControllers. I have three viewControllers (view_1 ,view_2 and view_3). Here my setup:- Select view_1 pushes view_2 pushes view_3 I want to send the ViewController reference(id) of 'view_1' to 'view_3'. so i include include "view_3" in 'view_1' and set the value into the variable of 'view_3'( using view_3 *v3=[[view_3 alloc] init ]; v3.reference=self; ). In the console it shows: view controller :- ; <ViewController: 0x89e9540> in the 'view_1' but in the 'view_3', in console it shows view controller (null) But when i used 'view