Segmented Control in a table view

What’s the most efficient way to prevent a Segmented Control from scrolling up and out of view, in a Table View Controller?

Would the work-around be: to have a Segmented Control on top of a Table View, both element stacked together, in a View Controller.

Your thoughts / opinions welcomed.

TIA.

i guess if you really want it set in place then it should be inside a stackview where the controls are at the top or bottom and the uitableview is seperate

if you want to freeze/sticky the tableview headers maybe you can check this stackoverflow thread