MLQ
MLQ

Reputation: 13511

Display UITableView's section title when index is touched

I'm writing a dictionary app to study iOS and I've implemented a UITableView with the alphabet as section titles and an index of all the letters on the right side. It works perfectly, but is it possible for me to display the selected index in a box at the center of the screen? I'm looking at the UITableViewDelegate reference but can't see any methods I might override. Help?

Upvotes: 1

Views: 739

Answers (2)

Christian Schnorr
Christian Schnorr

Reputation: 10776

You'd have to manually create a UIView that you put above the UITableView which then shows the letter or whatever you want to present. Make sure not to add it to the table view itself as it's a UIScrollView subclass and your view would be affected by its contentOffset.

When the user presses one index or moves his finger above it, this callback gets called:

-tableView:sectionForSectionIndexTitle:title atIndex:

Use it to change your view's contents and make it visible and set a timer for it to fade out again.

Upvotes: 2

Dilip Manek
Dilip Manek

Reputation: 9143

You have to create custom view that display when you click on the cell and in that view you can add Label to show the alphabet which you have selected.

And yes also if you want to display it on center of your screen than give its X and Y coordinates value according to it.hope it helps...

Upvotes: 0

Related Questions