segue

macOS, Swift 3: How to get data back after segue?

南笙酒味 提交于 2019-12-22 10:24:37
问题 For example: I have two UIViewController s. The first has a button and a NSTextField , and the second has a NSTextField only. When I click the button on the first controller — the second controller shows as popover window. Making a transfer of some data from first controller to second is not big deal — I use a segue. But what I should to do to transfer data back — from the popover window to main window? For example: we open the popover window, type some text in NSTextField , and I want to get

How to pass data from one view controller to the other SWIFT

久未见 提交于 2019-12-22 09:44:18
问题 I am making an app where a table view with a search bar and scope bar has to segue to a detail view controller and that detail view controller has to display data based on which cell is selected. I have an array with structs set up to sort and search for the items. I need to keep this feature, I have another swift class for my detail view controller that I will put if/else statements into that deal with displaying the data based on what cell I select. What I need to know how to do is attach a

Why can't I pass value using prepareForSegue?

泄露秘密 提交于 2019-12-22 09:39:10
问题 I have two UIViewControllers .In A ViewController I have code: - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqualToString:@"ToResetPwd_NumberSegue"]) { ResetPwdBySmsCodeViewController* vc = (ResetPwdBySmsCodeViewController*)[segue destinationViewController]; vc.phone_no = _TF_phoneOrEmail.text;//TF_phoneOrEmail is a UITextField vc.test = @"dagaga"; } } In B .h I have code @interface ResetPwdBySmsCodeViewController : UIViewController

Modal Segue Chain

两盒软妹~` 提交于 2019-12-22 06:49:30
问题 I have an iOS app that has a log in view ( LognnViewController ) and once a user is successfully authenticated they are taken to another view ( DetailEntryViewController ) to enter some simple details. Once the details are entered the user is taken to the main part of the app that consists of a tab controller ( TabViewController ) that holds a variety of other views. The LogInViewController performs a modal segue to the DetailEntryViewController and the DetailEntryViewController then performs

Defining a “generic” segue in Interface Builder

删除回忆录丶 提交于 2019-12-22 03:42:35
问题 I understand how to create a segue in XCode 4.2 by right clicking a control, let's say a button, and dragging it to a view controller in the storyboard. What I would like to do is create a segue that is not tied to a control, and must be invoked programmatically so I can do something like this: - (void)viewDidLoad { if (condition) { [self performSegueWithIdentifier: @"identifier" sender: self]; } } while still defining the "identifier" segue within Interface Builder. Is this possible? 回答1:

performSegueWithIdentifier produce no segue with identifier error

夙愿已清 提交于 2019-12-22 03:22:47
问题 I am having hard time getting performSegueWithIdentifier to work. I keep getting "Receiver (<UINavigationController: 0x1e59a9d0>) has no segue with identifier 'identA'" What I did is that: Step: created a single view application and added a label - "View controller A" to the view controller. Step: Dragged and dropped another View Controller and added a label - "View controller B" to the new view controller. Step: Chose view controller A and performed Editor->embed in->navigation controller

prepareForSegue is not getting called when I click on a button without using performSegueWithIdentifier

一笑奈何 提交于 2019-12-22 01:52:39
问题 Based on the Stanford iOS course I am playing with modal view controllers. In the demo they have a button that would launch a modal view and when it is clicked the function prepareForSegue is called. I mimicked the code and implementation into my project with the only difference is that my demo is on an iPhone storyboard and theirs is on the iPad. I noticed that while my modal view controller is coming up, it does not call prepareForSegue prior to that. I searched the Stanford project to see

Problems passing data to a DetailViewController from TableView in iOS5

不羁岁月 提交于 2019-12-21 17:32:32
问题 I would appreciate any help in solving my problem that has had me pulling my hair out for the last day! Disclaimer 1 I'm an Objective-C noob - so the answer to this may be very simple (I'm coming from years of PHP). Please be nice. Disclaimer 2 Yes, I have extensively 'Googled' and looked at Apple Documentation - but have failed to come to an understanding of my problem. Summary I am trying to pass a value selected in a table view to another controller from a singleton. I am finding that the

PerformSegueWithIdentifier does not work

扶醉桌前 提交于 2019-12-21 03:32:52
问题 I am trying to use use self.performSegueWithIdentifier to change the view on the Storyboard when a JSON file loaded remotely. For this I am using the Swift Class "Agent" to perform the HTTP request. Everything is working when I write the self.performSegueWithIdentifier("toView2", sender: self) out of the "done" variable. Why is it not working? I guess it has something to do with the "sender: self". But I don't know how to solve this. I don't get any errors on Xcode. It just loads the data

Segue not getting selected row number

不羁的心 提交于 2019-12-20 23:32:26
问题 I am passing data from a table view controller to a detail view. I tried using indexPath.row directly in my prepareForSegue method, however it displays an error of use of unresolved identifier 'indexPath' So, after searching the web, I set up the variable indexOfSelectedPerson which is assigned the value of indexPath.row . The problem when I run the app in the simulator is that prepareForSegue is getting the initial value of indexOfSelectedPerson (0), then getting the value of the selected