standardnotes / iOS-classic

iOS client - (Deprecated) - New version: https://github.com/standardnotes/mobile
167 stars 21 forks source link

Issue #5 Search Bar in Notes List #14

Closed jz709u closed 7 years ago

jz709u commented 7 years ago

-Allow inline search of notes -Searches text, title, and tags

moughxyz commented 7 years ago

Thanks J, I will review this tomorrow hopefully. Almost finished on some big refactors on the web app.

moughxyz commented 7 years ago

Hmm..you're using UITextField for search instead of UISearchBar. This is not standard behavior for iOS apps. We want to make sure we replicate Apple apps as much as possible, because Apple will try hardest to preserve those, and we want to be persevered as well ;)

Can you please update this to use UISearchBar, similar to Apple Mail app on iOS. It should be hidden by default, but if user scrolls up, it will show. I'm not sure if that requires a UISearchController. Maybe you can just set tableView.tableHeaderView = searchBar. Not sure really..

jz709u commented 7 years ago

Done

jz709u commented 7 years ago

Changed

moughxyz commented 7 years ago

Thanks @jz709u. Looking good, will test time this week.

moughxyz commented 7 years ago

Looks great. But how can we make it so that the search bar is hidden by default?

jz709u commented 7 years ago

it's not hidden by default? In which case is it showing by default? I have this code: tableView.setContentOffset(CGPoint(x:0,y:-15), animated: false) in viewWillAppear.

I tested around and the only case where it doesn't hide again is when you press a note and then come back

can you explain to me in what cases should it be hidden anytime you present the notes page is that it?

moughxyz commented 7 years ago

@jz709u it should be hidden when you launch the app. Check out Mail.app. When you launch the app (remove from background first), searchbar will be hidden and remain hidden until you show it. Then it will remain in view until you hide it via scroll.

jz709u commented 7 years ago

test it now please

moughxyz commented 7 years ago

This doesn't work because this is a universal app, so you can't use constant contentOffset. Not displaying correctly on iPad.

moughxyz commented 7 years ago

But actually

tableView.setContentOffset(CGPoint(x:0, y:-self.searchBar.frame.size.height/2 + 2), animated: false)

seems to be working. Still not ideal though.

moughxyz commented 7 years ago

Actually turned out to be an issue with that too. I went the tableHeaderView route and that seems to be better: https://github.com/standardnotes/iOS/commit/db21ca61b4105ab15202ce4a6066102941bb7dcc