Question: I want to reuse table view cell buttons. Initially I have two buttons in the cell as hidden and one button visible. when I click on the visible button the hidden two buttons will also be visible. I set the button target action. here is my code

```
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "CellForEndItem", for: indexPath as IndexPath) as! CellForEndItem
        cell.incrementBtn.isHidden = true
        cell.decrementBtn.isHidden = true
        cell.priceLbl.text = "$ 200"

        cell.counterBtn.tag = indexPath.row
        cell.incrementBtn.tag = indexPath.row
        cell.decrementBtn.tag = indexPath.row
        cell.counterBtn.addTarget(self, action: #selector(CounterBtnTapped(sender:)), for: .touchUpInside) }

```

Now bellow is my CounterBtnTapped method..

```
var count: Int = 0
    func CounterBtnTapped(sender: UIButton) {
            self.count += 1
            let indexPath = IndexPath(row: sender.tag, section: 0)    
            let cell = self.tableView.dequeueReusableCell(withIdentifier: "CellForEndItem",for: indexPath) as! CellForEndItem
            cell.incrementBtn.isHidden = false
            cell.decrementBtn.isHidden = false
            sender.setTitle(String(self.count), for: .normal)
    }

```

But somehow, the increment and decrement buttons are not visible. What the wrong I am doing here. Need experts suggestion??

Answer: 
Simply put a button to navigation item through storyboard and change it's background color. create a outlet of `UIButton` and make rounded corner.

[![enter image description here](https://i.stack.imgur.com/TTabF.png)](https://i.stack.imgur.com/TTabF.png)

```
@IBOutlet weak var barBtn: UIButton!

override func viewDidLoad() {
  super.viewDidLoad()

   barBtn.layer.cornerRadius = 5
   barBtn.layer.borderWidth = 1
   barBtn.layer.borderColor = UIColor.blackColor().CGColor
 }

```
You can create a custom button and then add customView to the navigationbar button that is rightbarbuttonitem in your case.

```
var view = UIView(frame: CGRectMake(0, 0, 100, 44))
view.backgroundColor = UIColor.blueColor()
var barButtonItem = UIBarButtonItem(customView: view)
self.navigationItem.rightBarButtonItem = barButtonItem

```

Add the relevant code to make your button look like design and then add it in the customView.