Question: I was trying to implement an overlaying button over UITableView in my UIView.

That's what I did:

* Created button in Storyboard

![storyboard](https://i.stack.imgur.com/hqAf5.png)
* Ordered elements:

![order](https://i.stack.imgur.com/ohbhs.png)

* In my `viewWillAppear` added:

`[self.navigationController.view addSubview:self.myBtn];`

It seems enough to display it correctly, but when I perform segue forth the next view I still see this button. That's why I added this in segue:

```
if ([[segue identifier] isEqualToString:@"addEvent"]) {
    [self.myBtn removeFromSuperview];
    }

```

Now it disappears on the next screen, but if I tap back on it, this button won't appear on my previous view. What's wrong?

If you know other ways to implement *floating* foursquare-like button, I'm opened to it. The simple way described [here](https://stackoverflow.com/questions/20203784/how-to-place-a-button-over-the-uitableview-like-foursquare) isn't working: UITableView overlays the button.

Answer: 
I'm adding this as an answer as I currently can't comment, and was helpful for myself. If you find that a segment of your json is being encoded as an array instead of an object (e.g.:the key's are being dropped). 

You can add JSON\_FORCE\_OBJECT like this:
 `json_encode($foo,JSON_FORCE_OBJECT);`
This will force everything to be encoded as an object, preserving all keys. 

You can find more flags here: <http://php.net/manual/en/function.json-encode.php>
I believe the reason why it is dropping the indexes is because they are indexed by number so when encoding it just thinks it does not need the keys you could try making your keys into strings as opposed to integers so the encoding doesn't wipe them.