ios - programmatic UITableView's didSelectRowAtIndexPath not responding to touch -
i programmatically created uitableview custom keyboard extension within default keyboardviewcontroller.swift reason didselectrowatindexpath not responding @ all. i've made sure set userinteractionenabled true both table cells , made sure set allowsselectionduringediting true. tableview being populated , cells highlighted when touch them logs not appearing @ (nor method breaking when there breakpoint on it).
anyone have ideas on may have screwed make happen?
class keyboardviewcontroller: uiinputviewcontroller, uitableviewdelegate, uitableviewdata source { var tableview: uitableview = uitableview() //other setup override func viewdidload() { super.viewdidload // other setup here tableview.frame = cgrectmake(0, 0, 320, 160) tableview.delegate = self tableview.datasource = self tableview.registerclass(uitableviewcell.self, forcellreuseidentifier: "cell") tableview.allowsselection = true tableview.allowsselectionduringediting = true tableview.userinteractionenabled = true self.view.addsubview(tableview) } //delegate&datasource methods func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int { let sectiontitle = artistsectiontitles[section] let sectionartist = artists[sectiontitle] return sectionartist!.count } func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { var cell:uitableviewcell = tableview.dequeuereusablecellwithidentifier("cell") uitableviewcell cell.userinteractionenabled = true let sectiontitle = artistsectiontitles[indexpath.section] let sectionartists = artists[sectiontitle] let artist = sectionartists?[indexpath.row] nsstring cell.textlabel?.text = artist return cell } func tableview(tableview: uitableview, heightforrowatindexpath indexpath: nsindexpath) -> cgfloat { return 22 } func tableview(tableview: uitableview, didselectrowatindexpath indexpath: nsindexpath) { tableview.deselectrowatindexpath(indexpath, animated: false) println("you selected cell #\(indexpath.row)!") } func tableview(tableview: uitableview, titleforheaderinsection section: int) -> string? { return artistsectiontitles[section] } func sectionindextitlesfortableview(tableview: uitableview) -> [anyobject]! { return artistsectiontitles } func numberofsectionsintableview(tableview: uitableview) -> int { return artistsectiontitles.count }
how tracking selection in fact not work? because if rows light - should work.
maybe changing tableview delegate somewhere?
also try changing cell selectionstyle property.
Comments
Post a Comment