Skip to content

Instantly share code, notes, and snippets.

@staycreativedesign
Last active July 7, 2017 22:32
Show Gist options
  • Select an option

  • Save staycreativedesign/1f3883f80d9a281b4296efe94f404178 to your computer and use it in GitHub Desktop.

Select an option

Save staycreativedesign/1f3883f80d9a281b4296efe94f404178 to your computer and use it in GitHub Desktop.
whenever cell leaves the view, it becomes isHidden = True how do I have it where the animation actually changes the isHidden to false and it stays that way?
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return(finalPoints.count)
}
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let card = finalPoints[indexPath.row]
tableView.separatorStyle = .none
tableView.allowsSelection = false
tableView.bounces = false
tableView.backgroundColor = UIColor(red:0.22, green:0.04, blue:0.27, alpha:1.0)
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
cell.backgroundColor = UIColor(red:0.22, green:0.04, blue:0.27, alpha:1.0)
cell.textLabel?.textColor = card.color
cell.textLabel?.textAlignment = .center
cell.textLabel?.font = UIFont(name: "Helvetica", size: 28)
cell.textLabel?.text = card.name
cell.isHidden = true
queue.addOperation {
print("hey \(indexPath.row) \(Date())")
usleep(500000)
DispatchQueue.main.async {
UIView.animate(withDuration: 1.0, animations: {
cell.isHidden = false
})
}
}
return(cell)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment