1

I have a UITableViewController hosted in a NavigationController which is in a Tab.

I wish to have a UISegmentedControl float over the table so that as the table scrolls, the UISegmentedControl is visible.

To what subview do I add the UISegmentedControl?

1 Answer 1

1

Try adding your UISegmentedController to your UINavigationController as a UIBarButtonItem with something along the lines of:

UISegmentedController * sc = ...
sc.segmentedControlStyle = UISegmentedControlStyleBar;

UIBarButtonItem *segmentBarItem = [[UIBarButtonItem alloc]
                                      initWithCustomView:segmentedControl];

myUINavigationController.navigationItem.rightBarButtonItem = segmentBarItem;

-- if you want to have the UISegmentedController float on top of your table (obscuring it) you should add a transparent UIView that sits above the UITableView and stick it in there. But that's probably not what you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.