# UIBarButtonItem action does nothing

**URL:** <https://forums.kodeco.com/t/uibarbuttonitem-action-does-nothing/15343>\
**Category:** iOS\
**Created:** [May 29, 2016, 7:58pm UTC](https://forums.kodeco.com/t/uibarbuttonitem-action-does-nothing/15343 "2016-05-29T19:58:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonny](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jonny/32/79544_2.png) [@jonny](https://forums.kodeco.com/u/jonny)\
**Post date:** [May 29, 2016, 7:58pm UTC](https://forums.kodeco.com/t/uibarbuttonitem-action-does-nothing/15343/1 "2016-05-29T19:58:16Z")

</div>

Hi

I’m a little worried this is too stupid a question to ask here, but here goes. I have a tableViewController with static cells to take some setting information. I’ve added a bar button called “Done” and hooked it up to my controller. I am attempting to just update the settings for a particular user. But it does nothing. I’ve tried just a basic print() in here and still nothing. So I’m really lost as to why it doesn’t work. I’ve attached a screen shot too

 ![](https://raywenderlich-com-v3-forums.s3.amazonaws.com/original/3X/d/1/d1a630272a56019ead0c51baf85a6f56b50e6217.png)

---

<div class="post-metadata">

**Author:** ![aeberbach](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/aeberbach/32/81494_2.png) [@aeberbach](https://forums.kodeco.com/u/aeberbach)\
**Post date:** [May 30, 2016, 1:26am UTC](https://forums.kodeco.com/t/uibarbuttonitem-action-does-nothing/15343/2 "2016-05-30T01:26:20Z")

</div>

There are no stupid questions just stupid storyboards… or something like that.

Anyway, unwind segue is confusing and a little more complicated than it needs to be in my opinion. You can use the special “Exit” item at the top of the view controller, and you have to link it up as this incredibly popular Stack Overflow [answer](http://stackoverflow.com/a/15839298/189804) describes.

But what I usually do is link the control that I want to do the exit with to a plain IBAction in my view controller - and at the end of whatever actions I want to do I use `dismissViewController:` or `popViewController:` (depending on whether or not I am in a nav controller).

Yes it is _slightly_ more code, but what it does is obvious and simple.

---

<div class="post-metadata">

**Author:** ![jonny](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jonny/32/79544_2.png) [@jonny](https://forums.kodeco.com/u/jonny)\
**Post date:** [May 30, 2016, 2:11am UTC](https://forums.kodeco.com/t/uibarbuttonitem-action-does-nothing/15343/3 "2016-05-30T02:11:19Z")

</div>

Ok, I will look into this, again thank you.

I am taking from the read of you answer that I should remove the unwind segue and just call a IBAction that updates my Data Model and then finishes with the dismissViewController or popViewController which would effectively return me back to my Navigation controller?

---

<div class="post-metadata">

**Author:** ![vaibhavdev](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/vaibhavdev/32/40692_2.png) [@vaibhavdev](https://forums.kodeco.com/u/vaibhavdev)\
**Post date:** [May 30, 2016, 5:43am UTC](https://forums.kodeco.com/t/uibarbuttonitem-action-does-nothing/15343/4 "2016-05-30T05:43:25Z")

</div>

hi Jonny ,

popViewController will effectively return me back to your Navigation controller . More Over there may be a constants issue or Autolayouts issue . just check it once in story board . Even just try my having a executable break point .

---

<div class="post-metadata">

**Author:** ![jonny](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jonny/32/79544_2.png) [@jonny](https://forums.kodeco.com/u/jonny)\
**Post date:** [June 1, 2016, 1:03am UTC](https://forums.kodeco.com/t/uibarbuttonitem-action-does-nothing/15343/5 "2016-06-01T01:03:57Z")

</div>

Thanks for your help, in the end I went for

```
// return back to nav controller
    self.dismissViewControllerAnimated(true, completion: nil)

```

And it seemed to work fine. I am not sure what or if there should any kind of error checking here though. Can this method fail at all and I need a way to catch any error?

---

<div class="post-metadata">

**Author:** ![aeberbach](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/aeberbach/32/81494_2.png) [@aeberbach](https://forums.kodeco.com/u/aeberbach)\
**Post date:** [June 1, 2016, 5:20am UTC](https://forums.kodeco.com/t/uibarbuttonitem-action-does-nothing/15343/6 "2016-06-01T05:20:24Z")

</div>

It won’t fail badly - it can fail to do anything at all if there is no view controller that can be dismissed.
