check / uncheck the check box by tapping the cell in table view and how to know which cell has checked or unchecked
<p>i am new to ios swift 2.2 . I tried to create one table view with custom cell xib. and i am populating some data in my table view. And also i added one custom check box button. And i am creating separate class for that check box button. Now when i click only on  my button in my customcell.xib .But when i tap on my cell, my check box are not changing. i need to have both. When i click on my button it should change to check and uncheck image. When i tap on my cell also i need to change my button to check or uncheck image</p>

<p>And when i scroll down and again come back to top, my checked images are automatically chnaged to normalcheck box.</p>

<p>i need to do some action , so for that. When i tap on any cell my check box should check and uncheck.And alos i need to know which row cell has checked image . So that i can perform some action for my checked image row cell alone.</p>

<p>here is my custom check box class:</p>

<pre><code>import UIKit

class CheckBoxButton: UIButton {

    // Images
    let checkedImage = UIImage(named: "CheckBoxChecked")! as UIImage
    let uncheckedImage = UIImage(named: "CheckBoxUnChecked")! as UIImage

    // Bool property
    var isChecked: Bool = false {
        didSet{
            if isChecked == true {
                self.setImage(checkedImage, forState: .Normal)
            } else {
                self.setImage(uncheckedImage, forState: .Normal)
            }
        }
    }

    override func awakeFromNib() {
        self.addTarget(self, action: #selector(CheckBoxButton.buttonClicked(_:)), forControlEvents: UIControlEvents.TouchUpInside)
        self.isChecked = false
    }

    func buttonClicked(sender: UIButton) {
        if sender == self {
            if isChecked == true {
                isChecked = false
            } else {
                isChecked = true
            }
        }
    }

}
</code></pre>

<p>Cutom cell.xib class:</p>

<pre><code>import UIKit

class FavCell: UITableViewCell {

    @IBOutlet weak var FLabel1: UILabel!
    @IBOutlet weak var FLabel2: UILabel!

    @IBOutlet weak var checkbox: CheckBoxButton!
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }



    @IBAction func checkboxpress(sender: AnyObject) {
    }



}
</code></pre>

<p>my <code>viewcontroller.swift</code></p>

<pre><code>import UIKit

class FavVC: UIViewController {

    @IBOutlet weak var FavTableView: UITableView!

    //var FData = [FavouritesData]()

    var arrDict :NSMutableArray=[]

    let cellSpacingHeight: CGFloat = 5  // cell spacing from each cell in table view

    override func viewDidLoad() {

        super.viewDidLoad()

        self.jsonParsingFromURL()

        let nib = UINib(nibName:"FavCell", bundle: nil)

        FavTableView.registerNib(nib, forCellReuseIdentifier: "FCell")

    }
// web services method
    func jsonParsingFromURL ()
    {
//        let token = NSUserDefaults.standardUserDefaults().valueForKey("access_token") as? String

        let url = NSURL(string: "som url")

        let session = NSURLSession.sharedSession()

        let request = NSURLRequest(URL: url!)

        let dataTask = session.dataTaskWithRequest(request) { (data:NSData?, response:NSURLResponse?, error:NSError?) -&gt; Void in
            // print("done, error: \(error)")

            if error == nil
            {

                dispatch_async(dispatch_get_main_queue())
                {
                    self.arrDict=(try! NSJSONSerialization.JSONObjectWithData(data!, options: NSJSONReadingOptions.MutableContainers)) as! NSMutableArray
                    if (self.arrDict.count&gt;0)
                    {
                        self.FavTableView.reloadData()
                    }
                }

            }


        }
        dataTask.resume()
}
 func numberOfSectionsInTableView(tableView: UITableView) -&gt; Int
    {
//        return self.FData.count
        return self.arrDict.count
    }


    // number of rows
    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int
    {
        return 1
    }

    // height for each cell
    func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -&gt; CGFloat
    {
        return cellSpacingHeight
    }

    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell
    {

        let cell:FavCell = self.FavTableView.dequeueReusableCellWithIdentifier("FCell") as! FavCell
        cell.FLabel1.text=arrDict[indexPath.section] .valueForKey("favourite_name") as? String
        cell.FLabel2.text=arrDict[indexPath.section] .valueForKey("favourite_address") as? String
        return cell

    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
</code></pre>

<p>please help me out.</p>

<p>Thanks in advance</p>