segue

Passing data between View Controllers in Swift (From TableView to DetailViewController)

喜夏-厌秋 提交于 2019-11-30 23:56:23
I have two files, MyTableViewController and myViewController. I set UIImageView on TableCell in MyTableVIewController. myViewController does not contain anything. And I created an array called ImageArray which contains an array of Images. What I am aiming to do here is when I click an image on TableCell in myTableViewController, I want the clicked image to appear in the myViewController. And some description about the clicked image beside the image too. I want to use myViewController for users to get detailed information of the selected image. override func tableView(tableView: UITableView,

Unwind segue doesn't work in Swift 3 and iOS 10

不打扰是莪最后的温柔 提交于 2019-11-30 23:51:37
问题 I'm trying to test unwind segue in iOS 10 and Swift 3. I made a simple app like this: I add code for segue in TableViewController class and connect "Cancel" button and Exit on Table View Controller Scene: @IBAction func unwindToRootViewController(segue: UIStoryboardSegue) { print("Unwind to Root View Controller") } but my simple segue doesn't work. What am I doing wrong? 回答1: As can be seen in the comments above the problem was this: I add code for segue in TableViewController class The

segue does not work in simple segue test

痴心易碎 提交于 2019-11-30 22:47:58
问题 I have a weird problem. I have created 2 viewcontrollers in my storyboard: testSegueViewcontroller and nextPageViewController . The testSegueViewcontroller contains a UIButton NextPage. I Ctrl-dragged from this button to nextPageViewController and created a Push segue. The problem is when i run this program and clicking on the NextButton in the testSegueViewcontroller it does not show the nextPageVieController :-( Any ideas of what I'm doing wrong? 回答1: With this approach you should use modal

Unwind with more than 1 segue using iOS 7 UIViewController transition animations

一曲冷凌霜 提交于 2019-11-30 22:11:28
I am using the UIViewController animated transitions introduced in iOS7. I am able to produce some really great transitions going back and forth between VC's using segues etc. Take a look at my picture below: I can very easily go back and forth if it is just one segue/vc at a time. For example if, I go from Screen 1 to Screen 2, the animation works perfect. And then say I go back to 1 or forward to 3, it works perfectly. But, if you notice on screen 4 at the bottom there is a button that says "Back To Screen 1"—this is an unwinding segue to screen 1. The issue is, I can't get the transition

Receiver has no segue with identifier error message

余生颓废 提交于 2019-11-30 20:55:44
问题 I am using xcode 7 beta and swift 2.0. I am following a tutorial (youtube.com/watch?v=PKOswUE731c). In short i have a storyboard with 3 views; a protected vc, a login vc and RegisterViewController. I have set 2 segues segue modal with protected_vc <-> login_vc identified with loginView segue modal on a button in login_vc <-> RegisterViewController identified with registerView I encountered a problem when with a register button on my login vc. If i click the register button it crashes the app

Swift programmatically set segues

微笑、不失礼 提交于 2019-11-30 20:40:22
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 programmatically? You can use: performSegueWithIdentifier("yourSegueIdentifier", sender: nil) You dont

Is prepareForSegue right way of passing value between view controllers

巧了我就是萌 提交于 2019-11-30 20:38:43
I'm trying to learn Swift and I'm trying to develop the famous note application. There is an array bound to a tableview and another view for adding notes. At second view textfieldshouldreturn event triggers a segue and goes back to tableview. I wanted to learn if this is the right way. Because by doing this way I'm manipulating a variable in another view controller. I'm not a MVC master but I felt like it is wrong. Here is my code snippet: func textFieldShouldReturn(textField: UITextField) -> Bool { self.performSegueWithIdentifier("backSegue", sender: self) return true } override func

Conditional Segue in Swift

陌路散爱 提交于 2019-11-30 19:36:12
I want to do a "connexion" button in my app. And when you tap on it, it will open a new page if you have correct login. But, I read that we can't undo a segue, I suppose I need to call it manually. Do you have an idea ? I still tried something like this : override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject) { if checkLog == true { //finish } else { // undo } } @IBAction func ConexTAP(sender: UIButton) { //check login } mxb You can do the credentials check in the following method in your ViewController : func shouldPerformSegueWithIdentifier(_ identifier: String!, sender:

Unwind with more than 1 segue using iOS 7 UIViewController transition animations

ⅰ亾dé卋堺 提交于 2019-11-30 18:29:24
问题 I am using the UIViewController animated transitions introduced in iOS7. I am able to produce some really great transitions going back and forth between VC's using segues etc. Take a look at my picture below: I can very easily go back and forth if it is just one segue/vc at a time. For example if, I go from Screen 1 to Screen 2, the animation works perfect. And then say I go back to 1 or forward to 3, it works perfectly. But, if you notice on screen 4 at the bottom there is a button that says

get sender of segue in destination view controller

余生长醉 提交于 2019-11-30 18:19:52
I have a VC named Dashboard (D) which can open a VC named Login (L) and a VC named Register (R). Login can open VC Register too. I try to use storyboard as often as possible, so I have created with it three Segues, D to L, D to R, L to R So, in case of D -> L -> R and in case of D -> R, when I close R, I have to close L if it necessary and inform D which he can begin to load the user infos (launch function in nutshell). So, I would like get the sender of Segue in destination vc, knowing that I put it in sender entrie of performSegueWithIdentifier like that : [self performSegueWithIdentifier:@