override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let detailview = segue.destinationViewController as! DetailView
if let indexPath = self.tableView.indexPathForSelectedRow {
_ = Int(indexPath.row)
print(indexPath.row)
detailview.currentObject = (indexPath.row as! PFObject)
}
}
class DetailView: UIViewController {
var currentObject : PFObject?
@IBOutlet weak var name: UILabel!
@IBOutlet weak var opysanie: UITextView!
@IBOutlet weak var price: UILabel!
@IBOutlet weak var image: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
if let object = currentObject {
name.text = object["name"] as? String
opysanie.text = object["opisanie"] as? String
price.text = object["price"] as? String
}
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if(segue.identifier == "DetailSegue"){
// check for / catch all visible cell(s)
if let indexPath = self.tableView.indexPathForSelectedRow {
let object: String = testarray[indexPath.row]
(segue.destinationViewController as! DetailView).currentObject = object as? PFObject
} }
}
var currentObject : PFObject?
@IBOutlet weak var name: UILabel!
@IBOutlet weak var opysanie: UITextView!
@IBOutlet weak var price: UILabel!
@IBOutlet weak var image: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
if let object = currentObject {
name.text = (object["name"] as! String)
opysanie.text = object["opisanie"] as! String
price.text = (object["price"] as! String)
}