segue

Perform segues when I want

白昼怎懂夜的黑 提交于 2019-11-29 16:45:39
Evening, I have 2 show segues in my VC. But I want to fires these segues only when my pickerView has a row.count > 0 . This is what I have: Override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if segue.identifier == "searchImages" { if pickerView.numberOfRows(inComponent: 0) > 0 { let controller = (segue.destination) as! WebViewController //replacing " " with "+" for google search queries let type: WebViewController.SearchType = .image let queryString = String(nameLabel.text!.characters.map { $0 == " " ? "+" : $0 }) controller.searchType = type controller.queryString =

iOS7 Storyboard image picker not working :(

风流意气都作罢 提交于 2019-11-29 13:57:50
Im trying to set up an imagePicker in a new iOS7 Xcode project using storyboards but can't seem to find any examples online until I found the following code. I've set it up so that when a button is pressed it uses a modal push thing to navigate to the view which has the class of "UIImagePickerController" which apparently calls in the image picker code. However when the app is run it won't load anything up after clicking on allow the application to access your photos any chance of some help please? Error screen shot grab: https://pbs.twimg.com/media/Bdy7v9JCAAABpvS.jpg:large interface setup:

UITableView didSelectRowAtIndexPath sometimes called after second tap

做~自己de王妃 提交于 2019-11-29 10:06:21
I'm facing a curious UITableView behaviour and i don't know where this is coming from. I'm building a very simple single view IOS8 Swift application with a first ViewController with a UITableView inside it and one custom Image cell. When i tap on a cell it Segue to my SecondViewController . My UITableView delegate and datasource is connected to the first ViewController. Everything is working except when i tap a cell sometimes i have to tap it twice to trigger the Segue. Here is my didSelectRowAtIndexPath function: func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath:

Make Segue programmatically in Swift

眉间皱痕 提交于 2019-11-29 09:13:27
I have two VCs: VC1 and VC2. In VC1, I have a finish button which I programmatically made and a result array I want to pass to VC2. I know how to make Segue in Storyboard, but I cannot do that at this moment since the finish button is programmatically made. If I want to pass result array using segue, is there a way to make the segue programmatically? If this is not possible, should I just present VC2 using presentViewController and set a delegate to pass the result array ? dehlen You can do it like proposed in this answer: InstantiateViewControllerWithIdentifier . Furthermore I am providing

How to Segue Randomly to ViewControllers in Swift? [closed]

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-29 08:55:40
For my Swift app, I'm trying to make it so that a button will lead to a random page in my Main.storyboard but I'm not sure if such a method exists. Is there a way for me to do this? Here is how you can segue to a random ViewController . For my example, I chose to use a UINavigation Controller and push segues, but you could do this just as easily with other segue types. I created this Storyboard by: Starting with the Single View Application template. Selecting the ViewController in the Storyboard and then Editor->Embed In->Navigation Controller from the Menu. I added 3 more ViewController s and

(Swift) PrepareForSegue: fatal error: unexpectedly found nil while unwrapping an Optional value

家住魔仙堡 提交于 2019-11-29 04:21:11
DetailViewController: @IBOutlet var selectedBundesland: UILabel! TableViewController: override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) { if (segue.identifier == "BackToCalculator") { var vc:FirstViewController = segue.destinationViewController as FirstViewController vc.selectedBundesland.text = "Test" } IBOutlet is connected! Error: fatal error: unexpectedly found nil while unwrapping an Optional value I read multiple pages about Optionals but i didn't know the answer to my problem. Do you need more information about my project? You cannot write directly to the

How can I segue to the second tab of a tab bar controller from the first tab?

放肆的年华 提交于 2019-11-29 04:20:26
I have no problem actually performing the segue, but when I do, my tab bar disappears from the bottom of the view. I have made a storyboard segue from TabBarController1 to TabBarController2. I've found a lot of answers for Objective-C, but none for Swift. This is the code for performing the segue: if requestsArray.count == 0 { self.performSegueWithIdentifier("offerSegue", sender: self) } else { self.performSegueWithIdentifier("confirm1", sender: self) } You don't want to segue. A segue creates a new instance of the destination view controller and presents it. That's why your tab bar is

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

廉价感情. 提交于 2019-11-29 03:26:15
问题 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

Dragging onto the exit of the viewcontroller not working

限于喜欢 提交于 2019-11-29 02:33:30
I have looked for this problem everywhere. I know how the unwind scene works. I have implemented the following code in the A VC -(IBAction)returned:(UIStoryboardSegue *)segue { try.text = @"Returned from Scene 1"; } But when I go to my B VC(Which is the VC I want to go back to A VC from) and ctrl drag a button onto the exit at the bottom it will not allow me to. And no function pops up in the exits option. Anyone else had this issue or can help? To set up an unwind segue, you should Set up your two scenes with the standard modal or push segue between them: Define the custom classes for those

How to dismiss the current ViewController and go to another View in Swift

£可爱£侵袭症+ 提交于 2019-11-29 01:38:18
I am new to Swift and I want to know how to dismiss the current view controller and go to another view. My storyboard is like the following: MainMenuView -> GameViewController -> GameOverView. I want to dismiss the GameViewController to go to the GameOverView, not to the MainMenuView. I use the following code in my MainMenuView: @IBAction func StartButton(sender: UIButton) { let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil) let nextViewController = storyBoard.instantiateViewControllerWithIdentifier("GameViewController") as! GameViewController self.presentViewController