Question: This should be straight foreward, but I simply can't figure it out(!)

I have a UIView 'filled with' a UIScrollView. Inside the scrollView I wan't to have a UITableView.

I have hooked up both the scrollView and the tableView with IBOutlet's in IB and set the ViewController to be the delegate and datasource of the tableView.

What else do I need to do ? Or what shouldn't I have done?

Answer: 
Personally, I would define the key-states as disjoint states and write a simple state-machine, thus:

```
enum keystate
{
    inactive,
    firstPress,
    active
};

keystate keystates[256];

Class::CalculateKeyStates()
{
    for (int i = 0; i < 256; ++i)
    {
        keystate &k = keystates[i];

        switch (k)
        {
        inactive:
            k = (isDown(i)) ? firstPress : inactive;
            break;
        firstPress:
            k = (isDown(i)) ? active : inactive;
            break;
        active:
            k = (isDown(i)) ? active : inactive;
            break;
        }
    }
}

```

This is easier to extend, and easier to read if it gets any more complex.
I'm not sure what you want to achieve with `IsFirstPress`, as the keystate cannot remember any previous presses anyways. If you want to mark with this bit, that it's the first time you recognized the key being down, then your logic is wrong in the corresponding `if` statement.

`keystates[i] & WasHeldDown` evaluates to true if you already set the bit `WasHeldDown` earlier for this keystate.
In that case, what you may want to do is actually remove the `IsFirstPress` bit by xor-ing it: `keystates[i] ^= IsFirstPress`