KKGridView icon indicating copy to clipboard operation
KKGridView copied to clipboard

UISearchBar as Header View

Open dirkvdb opened this issue 13 years ago • 3 comments

Hi,

I would like to add a UISearchBar as the GridView Header view which is not visible by default, only when the user scrolls the grid view down. I added the UISearchBar as Header view of the grid view and then call

self.gridView.contentOffset = CGPointMake(0, searchBar.frame.size.height);

in my ViewDidLoad, but somehow the offset is overridden by the grid view to be 0 again by the time it is on the screen.

What would be the best way to get a UISearchbar that behaves like one in TableView with UISearchDisplaycontroller?

Thanks

dirkvdb avatar May 31 '12 19:05 dirkvdb

Try calling it in viewDidAppear, prefixed with an if statement that checks if it's 0 or not.

Sent from my iPhone

On May 31, 2012, at 12:01 PM, [email protected] wrote:

Hi,

I would like to add a UISearchBar as the GridView Header view which is not visible by default, only when the user scrolls the grid view down. I added the UISearchBar as Header view of the grid view and then call

self.gridView.contentOffset = CGPointMake(0, searchBar.frame.size.height);

in my ViewDidLoad, but somehow the offset is overridden by the grid view to be 0 again by the time it is on the screen.

What would be the best way to get a UISearchbar that behaves like one in TableView with UISearchDisplaycontroller?

Thanks


Reply to this email directly or view it on GitHub: https://github.com/kolinkrewinkel/KKGridView/issues/146

kolinkrewinkel avatar May 31 '12 19:05 kolinkrewinkel

That does work but it is pretty ugly. It first shows the search bar and then you see it disappear, even with an animation it is kind of disturbing.

For my iPhone Interface I use a regular table view and there I can set the offset in the ViewDidLoad, is it possible to get the same behavior with the KKGridView?

dirkvdb avatar May 31 '12 19:05 dirkvdb

I'll look into what's causing it.

Sent from my iPhone

On May 31, 2012, at 12:23 PM, [email protected] wrote:

That does work but it is pretty ugly. It first shows the search bar and then you see it disappear, even with an animation it is kind of disturbing.

For my iPhone Interface I use a regular table view and there I can set the offset in the ViewDidLoad, is it possible to get the same behavior with the KKGridView?


Reply to this email directly or view it on GitHub: https://github.com/kolinkrewinkel/KKGridView/issues/146#issuecomment-6045033

kolinkrewinkel avatar May 31 '12 19:05 kolinkrewinkel