segue

Show ViewController from XIB-file-Button - Swift

五迷三道 提交于 2019-12-03 08:23:30
is there a way how to segue from a xib-file (custom TableViewCell) to another ViewController in the Main.storyboard. There's no possibility to drag a segue, like within the main storyboard. In the cell I've got a button, from where I want to change the view. How can I solve it? Thanks! You can always instantiate a view controller from your Storyboard and present it on button tapped: let storyboard = UIStoryboard(name: "Main", bundle: nil) let vc = storyboard.instantiateViewControllerWithIdentifier("ViewControllerID") as UIViewController self.presentViewController(vc, animated: true, completion

iOS: Make segue wait for login success

☆樱花仙子☆ 提交于 2019-12-03 07:26:32
问题 I am designing an iOS app using XCode 4.2's storyboard feature. The app has a login screen that takes a username and password and has a button to log in. Pushing the login button triggers a push seque to another view controller. However, I want the seque to wait until the login comes back successful before proceeding to the next view controller. I know about prepareForSegue:sender: but heres my issue: the login call is asynchronous. I therefore cannot perform the login there. Is there someway

How dismiss a viewController with storyboard from a push segue?

本小妞迷上赌 提交于 2019-12-03 07:21:16
I don't know why dismissViewControllerAnimated:completion: . I just want to do it. I start with a [self performSegueWithIdentifier:@"my_segue" sender:self]; But is I call the dismiss than nothing happens. I can create another segue, but it create a new view controller. My question is: How dismiss the performSegueWithIdentifier:sender: ? Do you have a navigationBar in the viewController that's calling: [self performSegueWithIdentifier:@"my_segue" sender:self]; If so, you'll need to use: [self.navigationController popViewControllerAnimated:YES]; to pop the view off the stack. There's one segue

ios - Navigation between multiple NavigationControllers

馋奶兔 提交于 2019-12-03 06:58:08
I'm trying to understand a behavior of navigating between ViewControllers with (and without) using a NavigationController and I'm misunderstanding some things while reading articles and docs so I decided to ask them. Main question is: What happened if we have multiple NavigationControllers in Storyboard and want to go from one to another? (And this can be achieved just using segues as we do between common VCs, am I right?) As I understand, a NavigationController represents a stack of ViewControllers within which we can pop and push these VCs. So now we change our "location" from VCs of the

iOS segue executed twice

两盒软妹~` 提交于 2019-12-03 06:14:39
I have a table view with different types of table view cells in it. In one of the cells, there are two buttons, which load a view controller when pressed. I am using the following function to handle the button press: - (IBAction)leftButtonPressed:(id)sender { // Getting the pressed button UIButton *button = (UIButton*)sender; // Getting the indexpath NSIndexPath *indPath = [NSIndexPath indexPathForRow:button.tag inSection:0]; // Loading the proper data from my datasource NSArray *clickedEvent = [[[SOEventManager sharedEventManager] eventsArray] objectAtIndex:indPath.row]; [[SOEventManager

Set UITextField text property in prepareForSegue

好久不见. 提交于 2019-12-03 06:04:26
I have a textField in my ViewController1. I have a push segue to my ViewController2 which also has a textField. I need to set the textField.text in my ViewController2 to be equal to the text in the textField in my ViewController1. Here's the code I have: - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqual:@"ViewController2"]) { ViewController2 *VCT = [segue destinationViewController]; VCT.title = @"View Controller #2"; VCT.textField.text = self.textField.text; } } The title setter works just fine. Why is the textField not working? You cannot set

swift 3 prepare(for segue: ) function broken? [duplicate]

巧了我就是萌 提交于 2019-12-03 05:43:49
问题 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 . for some odd reason , with swift 3, the prepare(for segue: method refuses to acknowledge the segue identifier. I have the following IBAction's connected to a couple button's on the UI: @IBAction func goToImagesPicker(_ sender: AnyObject) { performSegue(withIdentifier: "showImagePicker", sender: sender) } @IBAction func

Swift: Force show Navigation Bar in Modal

可紊 提交于 2019-12-03 05:42:07
I have the following Storyboard Segue in my Swift project: The animation is correct, but there is no navigation bar in the destination view controller. I want to force the destination view controller to have a navigation bar. I tried in the destination view controller: override func viewWillAppear(animated: Bool) { super.viewWillAppear(true) navigationController?.navigationBar.hidden = false } Or: override func viewWillAppear(animated: Bool) { self.navigationController?.setNavigationBarHidden(false, animated: true) } But it refuses to show any navigation bar. How can I perform a vertical segue

NSInvalidArgumentException reason Receiver has no segue with identifier

别说谁变了你拦得住时间么 提交于 2019-12-03 05:40:17
I have problem I've been sitting with. I have a UIViewController List and a UIViewController Login . On Login I have a button "Done", also another hidden button on the same UIViewController that has a segue to List (Type: push). I gave it an identifier in the interface builder of xcode named "LoginToList". Now from another class (a class that runs while Login is the active controller) I call: [[Login sharedLogin] performSegueWithIdentifier:@"LoginToList"]; The Login class clearly has a segue with identifier "LoginToList" Yet I keep getting: 'NSInvalidArgumentException', reason: 'Receiver (

How to get reference to UIPopoverController when using adaptive segue?

[亡魂溺海] 提交于 2019-12-03 05:19:52
In my iOS 7 app, I detected if a segue was a popover via this check in prepareForSegue : if ([segue isKindOfClass:[UIStoryboardPopoverSegue class]]) But now that I am using adaptive segues, the Present as Popover segue is no longer returning true in the above check. This is because segue is no longer a UIStoryboardPopoverSegue , instead it is a UIStoryboardPopoverPresentationSegue . However, one cannot simply add the Presentation word because that's not defined. What is the appropriate way to detect when the segue is a popover from an adaptive segue , as opposed to a full screen modal