logo
down
shadow

when preparing for segue array contains no data (using swift)


when preparing for segue array contains no data (using swift)

By : Mobile Invention
Date : November 17 2020, 11:58 AM
I wish did fix the issue. I infer from the absence of performing the segue programmatically that you must have set up both an IBAction as well as a segue from the button in Interface Builder. The problem is that the segue (and prepareForSegue) may be called before the IBAction is called. You should remove that segue, and create a new one that you'll invoke programmatically from the IBAction.
Therefore, you should not have the segue attached to the button in Interface Builder, but rather only have the button hooked up to the IBAction. You can then define a segue between the two scenes controller by control-dragging from the view controller button in the bar above the source scene to the destination scene:
code :
@IBAction func whenSatpinButtonPressed(sender: AnyObject) {
    pickedList += ["s","a","t","p","i","n"]      
    performSegueWithIdentifier("SegueToSecondScene", sender: self)
}


Share : facebook icon twitter icon
Preparing for segue in embedded tableView in Swift

Preparing for segue in embedded tableView in Swift


By : gs1679
Date : March 29 2020, 07:55 AM
I wish this help you The UIStoryboardEmbedSegue is used for embed relationships in ViewControllers. It is setting up the parent-child relationship between your RootVC and TableVC. It crashes because chances are you didn't se the identifier for this particular segue. You shouldn't be overriding this function in the RootVC if you are not interested in the embed relationship.
It looks like you didn't set up the segue from your cells properly. If you post a image of your storyboard, we can take a look.
IOS Swift Segue using data from selected Cell rather than the supporting array

IOS Swift Segue using data from selected Cell rather than the supporting array


By : BeWwy NJ
Date : March 29 2020, 07:55 AM
I hope this helps you . You shouldn't do what you want to / are trying to do. You should pass the image URL from your data model and use that.
Your problem is that you're creating / reusing a cell rather than finding the current one by doing:
code :
let cell = self.collectionView!.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath) as! CollectionViewCell
let cell = self.collectionView!. cellForItemAtIndexPath(indexPath) as! CollectionViewCell
Can't pass data to another view controller in when preparing for segue

Can't pass data to another view controller in when preparing for segue


By : tom.chan
Date : March 29 2020, 07:55 AM
like below fixes the issue The error is pretty informative. It says the class ViewController has no public or internal property called data. You'll have to declare a property called data in class ViewController.
code :
class ViewController: UIViewController {

  var data: String?

}
Swift 4 UITableViewCell first tap doesn't call segue, and second tap calls segue with the first cell data

Swift 4 UITableViewCell first tap doesn't call segue, and second tap calls segue with the first cell data


By : user1613376
Date : March 29 2020, 07:55 AM
it helps some times I'm having a problem with a TableView with cells using a XIB file, when I first tap on a cell, it does nothing, and when I tap on another cell, the segue is called, but with the data of the first cell tapped. I'm using "self.performSegue" on the "didDeselectRowAt" tableView Function. Here's my code: , Use this overload instead of didDeselectRowAt
code :
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        _ = tableView.dequeueReusableCell(withIdentifier: "CardCell") as! CardTableViewCell?
     self.eachCard = cardsArray[indexPath.row]

     self.performSegue(withIdentifier: "showCard", sender: tableView)
    }
iOS- make Segue perform after data is added to array (Swift)

iOS- make Segue perform after data is added to array (Swift)


By : zzaw
Date : March 29 2020, 07:55 AM
this one helps. I'm attempting to perform a segue which passes an image array to a new view controller, but the segue is being performed before the images are added to the array- I believe this is because URLSession, which I'm using to convert a url to an image, takes time. , Do it inside the callback
code :
DispatchQueue.main.async {
    self.imageArrayToBeSent.append(UIImage(data: data!)!)
    self.performSegue(withIdentifier: "openNewViewController", sender: self)
}
Related Posts Related Posts :
  • Badly placed ()'s error with the following shell script
  • Kotlin: Can I access a nested array from inside another array?
  • minimum complexity to find if a number is present n/2 times or not in a sorted array
  • Powershell: Comparing multiple values in an array
  • Add Elements to nullable Vector
  • How to get elements larger than x in a given range?
  • How to call Array-valued Functions in fortran?
  • How do I create and pass string array to a sub in Excel VBA?
  • How can I auto-sort an array in Swift by property type?
  • Trying to test collisions with objects in array
  • Sort an array of arrays in Erlang
  • push into deeply nested array
  • Encapsulate strings in an array in PowerShell
  • Send Specific variables through socket.io to client with socket.send
  • Max within groups in Matlab
  • How do you access the attributes of a class instance from inside an array? (Swift)
  • Array.Find and IndexOf for multiple elements that are exactly the same object
  • How to find array items that occur at least K times
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org