segue

ios pass values during a segue to another view

断了今生、忘了曾经 提交于 2019-11-30 11:21:44
问题 Trying to do something I've seen documented in a lot of places, but can't seem to manage. I'm trying to pass data from one view to another during a segue. Here's the prepareForSegue method in the source view: - (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { //pass values DetailViewController *dest = (DetailViewController *)[segue destinationViewController]; dest.locTitle = [value valueForKeyPath:@"title"]; dest.locInfo = [value valueForKeyPath:@"info"]; // NSLog(@"The

prepareForSegue : how can I set an if-condition?

余生长醉 提交于 2019-11-30 09:19:03
问题 This may be very rookie but... I've set a segue between two ViewControllers in my Storyboard , with the identifier clickBtn . Now I'm calling it this way in my code: - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([[segue identifier] isEqualToString:@"clickBtn"]) { if(conditionVerified) { SecondViewController *controller = (SecondViewController *)segue.destinationViewController; [controller setManagedObjectContext:self.managedObjectContext]; } else { // If I enter

Make button it UIAlertView perform Segue

时光总嘲笑我的痴心妄想 提交于 2019-11-30 09:17:33
I have created a UIAlertView for an action which gives me 2 options. I want the user to be able to click on a button and have it perform a Segue. Here's the code I have so far: - (IBAction)switchView:(id)sender { UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"Please Note" message:@"Hello this is my message" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Option 1", @"Option 2", nil]; [myAlert show]; } - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { NSString *buttonTitle = [alertView buttonTitleAtIndex:buttonIndex]; if (

-segueForUnwindingToViewController: fromViewController: identifier: not being called

你离开我真会死。 提交于 2019-11-30 06:37:42
I have created a custom segue that presents a view controller inside a container that is very similar with Apple's own modal view controllers (I've implemented it as a UIViewController subclass). I'm now trying to create a custom unwind segue but there's no way I can get the method -segueForUnwindingToViewController: fromViewController: identifier: to be called. I've also implemented -viewControllerForUnwindSegueAction: fromViewController: withSender: on my container so I can point to the correct view controller (the one that presented this modal) but then the method that should be asked for

How to segue back to a UIViewController that's already loaded?

拜拜、爱过 提交于 2019-11-30 06:12:34
问题 I have a view on a storyboard the has a button to perform a certain action. To perform this action though, the user must be logged in. The button handler tests if the user is logged in and performs one segue if YES and another if NO. The NO segues pushes to a login view controller. There is another segue connecting back to the first view controller so if login is successfull the user can pick up where they left off. The view controllers are embedded in a navigation controller. Problem is, the

How to segue with data from one Tab to another Tab properly

不打扰是莪最后的温柔 提交于 2019-11-30 05:59:53
问题 I have a Tab Bar Controller which is the Initial View Controller, which also has a PFLoginViewController that pups up if a user isn't logged in. The Login/Signup flow works fine. The two tabs are 1. a UICollectionView which I will refer to as IntroVC from now on 2. a UITableView which I will refer to as FeedVC When a user clicks a photo in IntroVC , a Show segue is triggered (via prepareForSegue ) that shows a 3rd screen ( UIView ) which is technically not a tab. I will refer to this as the

how to access segue in 'didSelectRowAtIndexPath' - Swift/IOS

爷,独闯天下 提交于 2019-11-30 05:20:26
I know how to pass data using segues from prepareForSegue function, but the thing i have a TableViewCell from which there are two possible segues to two different ViewControllers (let's just say A, B as of now). It was suggested here that it is best to connect the segues to View controller rather than the tableCell itself, which infact worked perfectly. But i want to pass information to the second View controller when the cell is clicked, So how to access segue that i connected to the Source ViewController. Code: Inside prepareForSegue if segue.identifier == "showQuestionnaire"{ if let

Getting reference to the view of a container view

三世轮回 提交于 2019-11-30 05:16:16
I am new to iOS App Development. I have connected a tableview controller such that when I select one of the rows I get another UIViewController using didSelectRowAtIndexPath. I have a container view inside this UIViewController which displays (say for the time being) index of the row on which didSelectRowAtIndexPath was called. I want to do this using a segue, but the problem is I don't know how to get a reference to the view controller which is formed by using the container view. I know you can get the destination View Controller using segue.destinationViewController in the prepareForSegue

Swift programmatically set segues

泪湿孤枕 提交于 2019-11-30 04:56:52
问题 I have a piece of parse code that checks to see if a user is logged in: PFUser.logInWithUsernameInBackground("myname", password:"mypass") { (user: PFUser!, error: NSError!) -> Void in if user != nil { // Do stuff after successful login. } else { // The login failed. Check error to see why. } } After the successful login I want to send the user to a new segue. I can't do this in the storyboard because I only want the segue to occur if the conditions are met. Is there anyway to create a segue

Passing data from modal segue to parent

家住魔仙堡 提交于 2019-11-30 04:13:56
I want to pass data (e.g. set var) from modal segue to parent, how can I do that? I’m using that code to exit from modal segue: @IBAction func doneClicked(sender: AnyObject) { self.dismissViewControllerAnimated(true, completion: nil) } I can’t use segue.destinationViewController here to pass data as i’m used to do on push segues. Create protocol on Modal ViewController protocol ModalViewControllerDelegate { func sendValue(var value : NSString) } Also declare in you Modal ViewController class var delegate:ModalViewControllerDelegate! Include this protocol ModalViewControllerDelegate in