I am attempting to add a button to a UITableView row that will interact with a MySQL database via a NSURL session. I have successfully pragmatically added buttons to a blank view controller, however it will not work when duplicated with a UITableView cell. No error is given
Code:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell: UITableViewCell = self.tableView.dequeueReusableCellWithIdentifier("cell")! as UITableViewCell
cell.textLabel?.text = self.textArray.objectAtIndex(indexPath.row) as? String
let button = UIButton(type: UIButtonType.System)
button.frame = CGRectMake(100, 100, 120, 50)
button.backgroundColor = UIColor.greenColor()
button.setTitle("Test Button", forState: UIControlState.Normal)
button.addTarget(self, action: "buttonAction:", forControlEvents: UIControlEvents.TouchUpInside)
cell.addSubview(button)
return cell
}