# Beginning Table Views · Control Events | Ray Wenderlich

**URL:** <https://forums.kodeco.com/t/beginning-table-views-control-events-ray-wenderlich/48156>\
**Category:** 🎓 Courses & Articles\
**Created:** [September 3, 2018, 11:22pm UTC](https://forums.kodeco.com/t/beginning-table-views-control-events-ray-wenderlich/48156 "2018-09-03T23:22:01Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![bdmoakley](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/bdmoakley/32/108772_2.png) [@bdmoakley](https://forums.kodeco.com/u/bdmoakley)\
**Post date:** [September 3, 2018, 11:22pm UTC](https://forums.kodeco.com/t/beginning-table-views-control-events-ray-wenderlich/48156/1 "2018-09-03T23:22:01Z")

</div>

* * *
This is a companion discussion topic for the original entry at [https://www.raywenderlich.com/5995-beginning-table-views/lessons/31](https://www.raywenderlich.com/5995-beginning-table-views/lessons/31)

---

<div class="post-metadata">

**Author:** ![berktv](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@berktv](https://forums.kodeco.com/u/berktv)\
**Post date:** [September 10, 2018, 4:10pm UTC](https://forums.kodeco.com/t/beginning-table-views-control-events-ray-wenderlich/48156/2 "2018-09-10T16:10:17Z")

</div>

Hi @bdmoakley! To the end of the video the app constantly crashes if I pressing Cancel button. I found that this happening because Cancel button doesn’t properly connected to the `@IBAction func cancel`.

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

I haven’t noticed when connection between view and controller was broken, but maybe there is the way to check this kind of problems before runtime?

---

<div class="post-metadata">

**Author:** ![billmatthews](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/billmatthews/32/103829_2.png) [@billmatthews](https://forums.kodeco.com/u/billmatthews)\
**Post date:** [September 16, 2018, 12:23pm UTC](https://forums.kodeco.com/t/beginning-table-views-control-events-ray-wenderlich/48156/3 "2018-09-16T12:23:48Z")

</div>

Hi @bdmoakley,

When I try to connect the Did End On Exit event to my done method, it doesn’t seem to behave in the same way that it did in your example. Dragging the connector onto the done method won’t highlight the method, but will instead only offer to insert an IBAction. Am I missing a step?

Thanks,  
Will

---

<div class="post-metadata">

**Author:** ![billmatthews](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/billmatthews/32/103829_2.png) [@billmatthews](https://forums.kodeco.com/u/billmatthews)\
**Post date:** [September 16, 2018, 12:35pm UTC](https://forums.kodeco.com/t/beginning-table-views-control-events-ray-wenderlich/48156/4 "2018-09-16T12:35:49Z")

</div>

Actually, scratch that I just answered my own question. Looks like when I connected the cancel and done IBActions, I had accidentally set the sender to UIBarButtonItem rather than Any, so it wasn’t accepting the appropriate inputs. Once I set the sender back to Any, it worked as demonstrated. Oops. 🙂

---

<div class="post-metadata">

**Author:** ![bdmoakley](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/bdmoakley/32/108772_2.png) [@bdmoakley](https://forums.kodeco.com/u/bdmoakley)\
**Post date:** [September 17, 2018, 6:26pm UTC](https://forums.kodeco.com/t/beginning-table-views-control-events-ray-wenderlich/48156/5 "2018-09-17T18:26:03Z")

</div>

Hi Berktv -

Generally this isn’t much of a problem. You could manually check or you can do UI tests to make sure there are no problems between builds. Often times, it’s a rare occurence and when it does happen, you’ll be immediately notified of it do to the app crashing.

---

<div class="post-metadata">

**Author:** ![bdmoakley](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/bdmoakley/32/108772_2.png) [@bdmoakley](https://forums.kodeco.com/u/bdmoakley)\
**Post date:** [September 17, 2018, 6:28pm UTC](https://forums.kodeco.com/t/beginning-table-views-control-events-ray-wenderlich/48156/6 "2018-09-17T18:28:54Z")

</div>

I’m glad to hear that you found the solution. Honestly, I find that these issues are great teachers. Once you run into a similar problem, you’ll know where to start investigating. Cheers!

---

<div class="post-metadata">

**Author:** ![qelloman](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/qelloman/32/81494_2.png) [@qelloman](https://forums.kodeco.com/u/qelloman)\
**Post date:** [September 27, 2018, 3:26am UTC](https://forums.kodeco.com/t/beginning-table-views-control-events-ray-wenderlich/48156/7 "2018-09-27T03:26:42Z")

</div>

Hi!

I tried to test the “did end on exit” event.  
I typed and pressed the return key, but nothing happened.  
I expected the same thing with the add button should happen.  
What did I wrong?

---

<div class="post-metadata">

**Author:** ![bdmoakley](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/bdmoakley/32/108772_2.png) [@bdmoakley](https://forums.kodeco.com/u/bdmoakley)\
**Post date:** [October 2, 2018, 3:47pm UTC](https://forums.kodeco.com/t/beginning-table-views-control-events-ray-wenderlich/48156/8 "2018-10-02T15:47:39Z")

</div>

It’s really hard to diagnose without additional information. Feel free to email your project to me at [brian@razeware.com](mailto:brian@razeware.com) and I’ll take a look. Thanks so much!

---

<div class="post-metadata">

**Author:** ![shimon](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shimon/32/79544_2.png) [@shimon](https://forums.kodeco.com/u/shimon)\
**Post date:** [April 6, 2019, 7:57am UTC](https://forums.kodeco.com/t/beginning-table-views-control-events-ray-wenderlich/48156/10 "2019-04-06T07:57:12Z")

</div>

Why not use ‘Editing Changed’ event to check if textfield is empty? Doesn’t it catch all cases like you implemented in shouldChangeCharactersIn handler?

In which scenario will the bellow guard return false?

> guard let oldText = textField.text,  
> let stringRange = Range(range, in: oldText) else {  
> return false  
> }

---

<div class="post-metadata">

**Author:** ![bdmoakley](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/bdmoakley/32/108772_2.png) [@bdmoakley](https://forums.kodeco.com/u/bdmoakley)\
**Post date:** [April 9, 2019, 2:18am UTC](https://forums.kodeco.com/t/beginning-table-views-control-events-ray-wenderlich/48156/11 "2019-04-09T02:18:49Z")

</div>

You’ll have to play around. The text property is an optional one so we have to take account for it.

---

<div class="post-metadata">

**Author:** ![interactivexr](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/interactivexr/32/110937_2.png) [@interactivexr](https://forums.kodeco.com/u/interactivexr)\
**Post date:** [May 14, 2019, 12:25pm UTC](https://forums.kodeco.com/t/beginning-table-views-control-events-ray-wenderlich/48156/12 "2019-05-14T12:25:58Z")

</div>

You just need to delete textFieldShouldReturn function in extension of UITextFieldDelegate and “did end on exit” event will trigger. Can somebody explain why this is working?

---

<div class="post-metadata">

**Author:** ![anon64497881](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@anon64497881](https://forums.kodeco.com/u/anon64497881)\
**Post date:** [July 7, 2019, 10:56am UTC](https://forums.kodeco.com/t/beginning-table-views-control-events-ray-wenderlich/48156/13 "2019-07-07T10:56:08Z")

</div>

> [@interactivexr](#):
>
> You just need to delete textFieldShouldReturn function in extension of UITextFieldDelegate and “did end on exit” event will trigger. Can somebody explain why this is working?

The same @bdmoakley 😐

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [July 9, 2019, 2:09am UTC](https://forums.kodeco.com/t/beginning-table-views-control-events-ray-wenderlich/48156/14 "2019-07-09T02:09:17Z")

</div>

@bdmoakley Can you please help with this when you get a chance? Thank you - much appreciated! :]
