mindz-eye / mytableviewindex Goto Github PK
View Code? Open in Web Editor NEWA pixel perfect replacement for UITableView section index, written in Swift
License: MIT License
A pixel perfect replacement for UITableView section index, written in Swift
License: MIT License
This function in TableViewIndex
open override func prepareForInterfaceBuilder() {
dataSource = TableDataSource()
}
throws a warning in Swift 4.2
Instance will be immediately deallocated because property 'dataSource' is 'weak'
When the return value of func indexItems(for tableViewIndex: TableViewIndex) -> [UIView]
of CollationIndexDataSource
is empty, touchs on TableViewIndex will cause crash.
Hello! A plan to support taptic engine?
I am using this library and it's working great. But it's yet not build with Swift 4.3 as it's required for Xcode 10 now. Please add support for Swift 4.3 so that we can continue using it.
Everything works fine if I call the following code for the first time:
self.tableView.reloadData()
self.tableIndexController.tableViewIndex.reloadData()
but after I update data source of the table view, that code makes the app freeze because layoutSubviews() gets called infinitely in TableViewIndex. But I need to update the index view, what should I do?
I tried this project in Swift 3.1 and lets just say it was a mess
CocoaPods
and Carthage
are awesome tools and make our life really easier, but there are some devs who still don't know how to use them.
It would be cool to add the Manual installation guide in your README.md
. You can take a look at my iOS Readme Template to see how you can do it.
Hey!, I have a quick question, Is it possible to change the default color (which is blue) of the truncation item class?.
do horizontal
It would be nice to have the built in feature described in the title. This is how I did it in the meantime, and here was the result.
Result - TableViewIndex pinned to 3rd section
func scrollViewDidScroll(_ scrollView: UIScrollView) {
let contentOffsetY = scrollView.contentOffset.y
if scrollView == tableView && searchBar.text == "" {
if let visibleRows = tableView.indexPathsForVisibleRows {
let visibleSections = visibleRows.map({$0.section})
if let allStopsIndex = sections.index(where: {$0.type == SectionType.AllStops}), let firstAllStopCellIndexPath = visibleRows.filter({$0.section == allStopsIndex && $0.row == 1}).first {
let secondCell = tableView.cellForRow(at: firstAllStopCellIndexPath)
let newYPosition = view.convert(tableViewIndexController.tableViewIndex.indexRect(), from: tableView).minY
if ((newYPosition * -1.0) < (secondCell?.frame.minY)! - view.bounds.midY) {
let offset = (secondCell?.frame.minY)! - initialTableViewIndexMidY - contentOffsetY
tableViewIndexController.tableViewIndex.indexOffset = .init(horizontal: 0.0, vertical: offset)
tableViewIndexController.setHidden(!visibleSections.contains(allStopsIndex), animated: true)
}
}
}
}
}
Here is a new one coming with iOS 13 - when a UITableView is being presented as a modal, the index can't be dragged because it causes rubber banding as that modal's dismissal takes priority.
Just starting to digging into this, but it looks like there's going to need to be some sort of callback to hook into to disable that gesture recognizer during MYTVI touches (see: https://stackoverflow.com/questions/56718552/disable-gesture-to-pull-down-form-page-sheet-modal-presentation).
I'm seeing an issue where the labels sometimes disappear, have you seen that before?
It occurs for me in a few different scenarios, like when I bring up the keyboard on iPad in portrait (which doesn't cause the truncation to occur because they all fit on screen) then rotate to landscape (where not all fit on screen so it has to truncate). A lot of the labels disappear, but their frame is preserved so there's space for each but they're not all visible. When I then dismiss the keyboard it expands out to show all but a few labels are not visible. What's interesting is the View Debugger shows the missing labels don't exist as subviews, they're not there at all.
I've been trying to debug it but haven't been able to figure out why this is occurring. It seems to be an issue when the height changes, it calls layoutSubviews
in the index view a few times with different heights, but the last one is always correct, yet it ends up not properly creating all the subviews it seems. Or maybe a race condition removing and re-adding? I'm not sure. Hoping you might know where the problem may lie.
This is a fantastic implementation, thank you! I'd like to request it be just as fantastic for users who rely on accessibility features like VoiceOver. It would ideally behave the exact same as it does for the native table index. This will ensure it can be intuitively used by all users!
I'll work on a pull request for this. ๐
The TableViewIndex is always displayed on the Right side of the tableView.
Since I have Arabic text inside table view which has text from right to left it is so I need the TableViewIndex on the left side
This is a bit of a nit pick but in my case it had serious implications. In order to tap outside of the section index to hit a table view row, you have to tap pretty far to the left. You can compare this to the native Contacts app to see the difference. For example, it interferes with the X in the screen shotted view. I tried to handle this through the indexInset
property but that did not work.
Hi, Sir!
Thanks for such an awesome library.
The issue is basically described in title, so it looks like 0.2.0 version podspec is not pushed to CocoaPods master repo :)
Hi and thank you for the great job on that library,
I'm having an issue with what should be a default behavior of the index:
When I tap an item, tableViewIndex(tableViewIndex, didSelectItem, atIndex)
is called, but not if I swipe through the index bar. It seems like touchesBegan
is called, but not touchesMoved
.
Most of my code is copied from the demo example which works perfectly fine, so I don't really know where to investigate.
Do you by any chance have an idea of what causes the issue?
Let me know if you need more info
Thanks!
On manual installation, XCode throws error: "Redeclaration of BackgroundView class"
As it is declared in Examples.swift and also a separate file named BackgroundView.swift having BackgroundView
Hi,
Thanks for the nice library!
I would like to report one small issue that I found while integrating the lib into an Objective-C project.
The problem is that indexInset, indexOffset and itemSpacing var-s are missing in auto-generated header and can not be accessed from Objective C. At the same time, when you edit library code and try to specify a different name for any of those properties via @objc(...), compiler starts showing "Property cannot be marked @objc because its type cannot be represented in Objective-C" error.
I made a small investigation and found that indexInset and indexOffset were visible correctly until 510e329. So, the problem appeared as soon as those struct-s became implicitly unwrapped optionals.
If I now simply change them back in a way that they wouldn't be optionals anymore, the problem disappears. If on your opinion this is ok (maybe there is a better solution...), I'll do a merge request.
Hi there,
I have implement your library in a project and i need click even of tableview cell where listed country name.
Can you please help from where i can find that.
Hello, thanks for this framework!
I have a question when I used the example, the font increases well with standard indexes when I used his index, the font is not increased. How can I fix it?
fileprivate func setupCustomSectionIndex() {
let tableViewIndexController = TableViewIndexController(tableView: tableView)
tableViewIndexController.tableViewIndex.dataSource = self
tableViewIndexController.tableViewIndex.delegate = self
tableViewIndexController.tableViewIndex.font = fontManager.lato(.Bold, size: 50)// 11.5
}
func indexItems(for tableViewIndex: TableViewIndex) -> [UIView] {
return sortedContactKeys.map { title -> UIView in // this doesn't work
let stringItem = StringItem(text: title)
return stringItem
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.