segue

Passing data with unwind segue

杀马特。学长 韩版系。学妹 提交于 2019-11-26 11:22:47
I created two view controllers. I created a segue from the first to the second to pass data. Now I want to pass data from the second view controller to the first one. I went through many similar questions and I'm not able to implement those as I lack the knowledge on how unwinding works. ViewController.swift class ViewController: UIViewController { var dataRecieved: String? @IBOutlet weak var labelOne: UILabel! @IBAction func buttonOne(sender: UIButton) { performSegueWithIdentifier("viewNext", sender: self) } override func prepareForSegue(segue: (UIStoryboardSegue!), sender: AnyObject!) { var

Segue from modal view to tab bar view controller and not lose tab bar

删除回忆录丶 提交于 2019-11-26 11:16:33
问题 Hello Im trying to segue from a modal to a tab bar view controller without losing the tab bar? I know the question is short, but this is all I\'m asking. Scenario: I have a Tab Bar View Controllers, A and B. B modals to C view controller. Then I want to return to View Controller A. Swift please :D 回答1: Here is my example of how to do this. In my setup, I choose the yellow ViewController from the tab, then press Go! which modally presents the white ViewController . Pressing Exit returns to the

Swift 3 How to display a confirmation screen based on MFMailComposeResult email screen

戏子无情 提交于 2019-11-26 09:58:50
问题 I\'m building an app that constructs an email and presents it in a MFMailComposeViewController for the user to send. When the user sends or cancels it I want the app to respond with an appropriate confirmation screen message. I\'m able to compose the email, dismiss the compose screen, and I have a named segue in IB from the pre-compose view to the confirmation view. But I cannot get that segue to execute. So, how can I update text message in the segue destination and then segue to it. Because

Perform Segue programmatically and pass parameters to the destination view

馋奶兔 提交于 2019-11-26 08:46:41
问题 in my app I\'ve a button that performs a segue programmatically: - (void)myButtonMethod { //execute segue programmatically [self performSegueWithIdentifier: @\"MySegue\" sender: self]; } I would like to know if there is a way to reference the destination view and to pass it some parameters. I know that in prepareForSegue method, I can refer to it with: myDestinationViewController *vc = [segue destinationViewController]; , but I don\'t know how to this executing the segue programmatically. Do

How do I create a segue that can be called from a button that is created programmatically?

风格不统一 提交于 2019-11-26 06:38:08
问题 In Swift I have a button created programmaticaly using: var button = UIBarButtonItem(title: \"Tableau\", style: .Plain, target: self, action: \"tabBarTableauClicked\") I want that when the user clicks the button it changes viewControllers. Here is the code for tabBarTableauClicked : func tabBarTableauClicked(){ performSegueWithIdentifier(\"tableau\", sender: self) } But it is obviously not working because there is no segue with an identifier called \"tableau\". And I can\'t create a segue

Segue and Button programmatically swift

十年热恋 提交于 2019-11-26 05:26:11
I am using iCarousel and I have to create my own button. I want to pass data from the button made programmatically to another view, but I don't have a segue identifier because I created the button programmatically. I don't know if it is possible to create the identifier of the segue programmatically. button.addTarget(self, action: #selector(buttonAction3), for: .touchUpInside) button.setTitle("\(titulos[index])", for: .normal) tempView.addSubview(button) let myImage = UIImage(named: "modo4.png") as UIImage? button.setImage(myImage, for: .normal) let viewController:UIViewController =

Prevent segue in prepareForSegue method?

别说谁变了你拦得住时间么 提交于 2019-11-26 04:59:52
问题 Is it possible to cancel a segue in the prepareForSegue: method? I want to perform some check before the segue, and if the condition is not true (in this case, if some UITextField is empty), display an error message instead of performing the segue. 回答1: It's possible in iOS 6 and later: You have to implement the method - (BOOL)shouldPerformSegueWithIdentifier:(NSString *)identifier sender:(id)sender In your view controller. You do your validation there, and if it's OK then return YES; if it's

Understanding performSegueWithIdentifier

会有一股神秘感。 提交于 2019-11-26 04:44:50
问题 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! 回答1: 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

Passing data between View Controllers using Segue

徘徊边缘 提交于 2019-11-26 04:25:38
问题 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:

Conditionally start at different places in storyboard from AppDelegate

青春壹個敷衍的年華 提交于 2019-11-26 04:05:39
问题 I have a storyboard set up with working login and main view controller, the latter is the view controller to which the user is navigated to when login is successful. My objective is to show the main view controller immediately if the authentication (stored in keychain) is successful, and show the login view controller if the authentication failed. Basically, I want to do this in my AppDelegate: // url request & response work fine, assume success is a BOOL here // that indicates whether login