segue

How do I use performSegueWithIdentifier: sender:? [duplicate]

房东的猫 提交于 2019-11-30 03:43:33
This question already has an answer here: Understanding performSegueWithIdentifier 4 answers I am a new iOS developer and I am currently building a game for the iPhone, and I am writing it in Objective-C. This question will probably be very easy to answer but I couldn't find it anywhere else. I am using storyboards in this app and I was using them fine when a user pressed a button to go to the next storyboard, however for this when the segue needs to occur automatically I am completely stumped as to how to achieve this. I want to have a logo appear for about five seconds when the app is

Conditional Segue in Swift

两盒软妹~` 提交于 2019-11-30 03:19:09
问题 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 } 回答1: You can do the credentials check in the

Passing variables between View Controllers using a segue

心不动则不痛 提交于 2019-11-30 03:17:43
I use Swift and Xcode 6 and would like to pass a variable from one View Controller to another using a Segue. I have created a segue called 'MainToTimer' which is trigger once button is pressed. I would like to be able to use the variable called 'Duration' on the second View Controller. Is it possible to pass multiple variables and constants? What code do I need associated to each View Controller? Thank you in advance. Donn First, setup property/properties to hold your variables in your second view controller (destination). class YourSecondViewController: UIViewController { var duration:Double?

get sender of segue in destination view controller

房东的猫 提交于 2019-11-30 03:03:15
问题 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

(Swift) Unwind segue when multiple view controllers lead to same view?

萝らか妹 提交于 2019-11-30 02:09:20
I am trying to code a hangman game and am having trouble with unwind segues. I have multiple view controllers that all ultimately lead to the same view, where the user plays the actual hangman. However, depending on the presenting controller, I want the game to be in different "modes" (ie: multiplayer, single player, etc.). I am trying to add a play again button that unwinds to the previous view controller, but am unsure how to unwind when there are multiple paths the user could have taken to get to this view. In other words, my app kind of goes: A -> B -> C or A -> D -> C where C can (ideally

performSegueWithIdentifier not working

醉酒当歌 提交于 2019-11-29 23:08:24
问题 I have this code that loads a new UIView (from storyboard) when a button is pressed. goPressed function is fired on button pressed and it calls selectImage function. selectImage opens a UIImagePickerController and lets user select a photo. After user has selected the photo, didFinishPickingMediaWithInfo delegate adds the selected image to a UIImageView. In 'goPressed', after selectImage is performed, it should be performing a Segue at like commented as //1. But nothing happens.

What are the differences between segues: “show”, “show detail”, “present modally”, “present as popover”? [closed]

半世苍凉 提交于 2019-11-29 18:59:03
What do the different segues do in Xcode 6? 1. Show - Pushes the destination view controller onto the navigation stack, moving the source view controller out of the way (destination slides overtop from right to left), providing a back button to navigate back to the source - on all devices. Example: Navigating inboxes/folders in Mail. 2. Show Detail - Replaces the detail/secondary view controller when in a UISplitViewController with no ability to navigate back to the previous view controller. Example: In Mail on iPad in landscape, tapping an email in the sidebar replaces the view controller on

IOS perform segue from tab bar item

泄露秘密 提交于 2019-11-29 18:23:57
I have a Tab bar controller with 2 items. The first item is a VC which contains a table view. Clicking on a cell, performs a segue to some other view controller (not an item on the tab bar controller). The problem is that it removes the tab bar when segue completes. How can I just replace the item 1 with other VC and still keep the tab bar in the bottom? You need to embed your Item1VC to NavigationController so that when you push from ItemVC to MoviesViewController it will not remove the tabbar, if you doesn't embed the NavigationController then it will push from the main ViewController in

Perform Segue from another class with helper function

橙三吉。 提交于 2019-11-29 17:37:11
I have two classes, ChargeCustomer and TwelvethViewController . In TwelvethViewController I have a func goNextView() which should perform a segue to next view controller when called. goNextView() is called from class ChargeCustomer inside a Alamofire completion handler. The problem is that this function goNextView() is never called and I can't figure out why. I tried to make it work based on this answer on stackoverflow Perform Segue From Another Swift File via a class function class TwelvethViewController:UIViewController { //when this func is called, it should segue to Thiretheen func

Passing data from the FirstViewController to the LastViewController

烂漫一生 提交于 2019-11-29 17:18:08
I have four viewControllers in my current design and I am designing an app to sell a product. FirstViewController gets the product image and when user clicks to the next button then it takes user to the secondviewcontroller where user describes the product and then user clicks next button which takes user to the thirdViewcontroller where price and condition are entered. In the lastviewcontolller there is a post button to send the product info to the server. I am using POST method. The following segue approach does not fit into what I want, because it sends the firstviewcontroller object