UITableView section index bar hide with Animation like iOS 8.4 Music App
| Originator: | pc.niedertscheider | ||
| Number: | rdar://22559857 | Date Originated: | 03-Sep-2015 07:38 PM |
| Status: | Open | Resolved: | |
| Product: | iOS | Product Version: | any |
| Classification: | Feature Request | Reproducible: |
It should be possible to show and hide the section index bar in UITableView.
Possible way of calling this would be:
UITableView:hideSectionIndexBar(Bool)
In my case I want to implement the same behavior like the new iOS 8.4 Music app. When starting to scroll the section index bar should disappear until dragging finished.
Steps to Reproduce:
Create a UITableView and implement section index titles.
Then add this code e.g. inside a UITableViewController subclass:
var showSectionIndexTitles = true
override func scrollViewWillBeginDragging(scrollView: UIScrollView) {
showSectionIndexTitles = false
UIView.animateWithDuration(0.5, animations: { () -> Void in
self.tableView.reloadSectionIndexTitles()
})
}
override func scrollViewWillBeginDecelerating(scrollView: UIScrollView) {
showSectionIndexTitles = true
UIView.animateWithDuration(0.5, animations: { () -> Void in
self.tableView.reloadSectionIndexTitles()
})
}
override func sectionIndexTitlesForTableView(tableView: UITableView) -> [AnyObject]! {
if showSectionIndexTitles {
return ["A", "B", "C", "D", "E"]
} else {
return nil
}
}
Expected Results:
Section Index bar should move in from right edge of view when showing and when hiding it should perform the same animation in reverse, moving out of the view on the right side.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!