0

I'm adding a touch down action to a uitextfield (actually it's a subclass, but I think that might not be important). I created a simple view controller and added this textbox to it, and wired up the event to println("Hello").

When I quickly tap the item (both in simulator, and on my phone) it works perfectly and says hello!

I then created a UITableViewController subclass, and in one of the static cells I added the same textbox.

In this case, when I quickly tap the textbox nothing happens! When I actually hold down the mouse or my finger for about 1/2 a second, it works. But not if I quickly tap it.

This is different from the previous textbox, which always works perfectly no matter how fast I tap it.

Are there some problems with different events being intercepted ors something of that sort? I even went so far as to add a tap gesture recognizer to both the table cell, and the textbox, but neither work unless I hold it down (the table cell action won't even fire unless I click off the textbox and into the cell proper, of course).

Thanks so much this is very strange.

NullHypothesis
  • 4,286
  • 6
  • 37
  • 79

1 Answers1

0

UIButton not showing highlight on tap in iOS7

and

iOS - Delayed "Touch Down" event for UIButton in UITableViewCell

have a lot of information about this. Apparently there is a delay for uitableviewcells that can be avoided by taking some of the approaches above.

I'll post the solution that works for me once I work on it. thanks!

EDIT OP DID DELIVER!! (lol sorry)

in IOS8, the idea is that table cells no longer have the uiscrollview that would basically delay the touching, so what you can do instead is something like this in your page did load:

for subview in self.tableView.subviews as [UIView]
    {
        if subview is UIScrollView
        {
            let scroll = subview as UIScrollView
            scroll.delaysContentTouches = false
            break
        }
    }

So see how we're iterating over self.tableview's subviews, and anytime we hit a scrollview set delaysContentTouches to false. This worked for me on both the simulator and on my phone.

Community
  • 1
  • 1
NullHypothesis
  • 4,286
  • 6
  • 37
  • 79