kolinkrewinkel / KKGridView

Deprecated: Grid view library for iOS.
https://github.com/kolinkrewinkel/KKGridView
Other
823 stars 151 forks source link

UISearchBar as Header View #146

Open dirkvdb opened 12 years ago

dirkvdb commented 12 years ago

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

kolinkrewinkel commented 12 years ago

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, dirkvdbreply@reply.github.com 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

dirkvdb commented 12 years ago

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?

kolinkrewinkel commented 12 years ago

I'll look into what's causing it.

Sent from my iPhone

On May 31, 2012, at 12:23 PM, dirkvdbreply@reply.github.com 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