iPhone Development - Show Floating View with Table View
-
20-08-2019 - |
Question
I have a Tab Bar Application with Navigation Controllers on each Tab Item. I want to add a floating (semi transparent view) on my Table View just above my Tab Bar. How can i achieve the results?
The results will be similar to how the Alpha list is displayed on the right of Contact Application's main view. I hope i'm clear in explaining what i want to do.
Any idea? Thanks.
Solution
If all you want to do is display the floating alphabetical (or numerical) index above your table view, you just need to define two methods in your UITableViewDataSource:
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index
These provide the A-Z (or whatever) list of section titles for your index, and where in the table view each section starts.
For a more custom view, you should be able to create a view, set its background to [UIColor clearColor], lay out its contents, and add it as either a subview to the table view or as a subview above the table view in a view that encloses both.