नहीं कहा जा रहा है IOS विकास के लिए नया और तालिका में सेल चयन को संभालने में समस्या हो रही है। जब भी मैं चुनता हूं, विधि नीचे नहीं जा रही है - कोई विचार क्यों?स्विफ्ट UITableView didSelectRowAtIndexPath को
मेरे परियोजना संरचना है: देखें नियंत्रक -> देखें -> टेबल देखें
नीचे कोड विधि कॉल को दर्शाता है। दूसरों को कोई समस्या नहीं कहा जाता है! मुझे पता है कि टच काम कर रहा है क्योंकि सफलतापूर्वक रीफ्रेश हो जाता है और सेल पर क्लिक करने पर यह हाइलाइट हो जाता है।
import UIKit
class ViewController: UIViewController, UITableViewDelegate
{
let blah = ["blah1"]
//How many sections are in the table?
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
//How many rows? (returns and int)
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return blah.count
}
//table contents for each cell?
//Each time this is called it'll return the next row and thus build a table...
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
print("Populating each cell of table view!\n")
tableView.rowHeight = 80.0
var cell = UITableViewCell()
var(a) = blah[indexPath.row]
var image : UIImage = UIImage(named: a)!
cell.imageView.image = image
return cell
}
//Code Cell Selected
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath){
println("You selected cell #\(indexPath.row)!")
}
func tableView(tableView: UITableViewDelegate, didDeselectRowAtIndexPath indexPath: NSIndexPath) {
print("wananananaanan")
println("You deselected cell #\(indexPath.row)!")
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
में ऊपर प्रतिनिधि विधि का उपयोग करें? –