-
Notifications
You must be signed in to change notification settings - Fork 338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I snap the progress to 1 right after my FlexibleHeightBar initialized? #27
Comments
Just move [searchBar.behaviorDefiner snapToProgress:1.0 scrollView:_scrollView]; to viewWillAppear. The problem is that scrollViewDidScroll delegate method gets called internally when gets draw by first time (so after viewDidLoad) to adjust the contentSize to the contentInset, and is there where this library logic is calculating the progress based on the last scrolled point, and since there isn't any yet, it resets it to 0. If you put a breakpoint in setProgress you will see it. |
@palcalde Thanks. u are right. Since I want to make my search bar looks like a widget, it's unlikely to access to the search bar in dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_MSEC),
dispatch_get_main_queue(), ^{
[_searchBar.behaviorDefiner snapToProgress:1.0 scrollView:_scrollView];
}); |
Well I met another weird issue, my BLK bar stays at progress 1.0, but when switching tabs (UICollectionView Cells), the BLK bar will suddenly change back to progress 0. If I want to keep it at its current progress, any way to do it? It is better to check the state and not put it in a main queue to move it back. |
I'm not sure why the bar resets to 0 on willAppear. Try to put a breakpoint on setProgress and see who calls it and why, I don't see anything in BLK library that changes the progress automatically, so should be somewhere in your code. You can always use viewWillAppear and do [self.yourBLKBar.behavior snapToProgress:1.0 scrollView:self.tableView] |
#31, this is my issue and I have know idea why. |
I have a search bar on top of a UIScrollView, and I'd like to hide the searchBar initially. And show the search bar when scrollView scrolls up, code like this:
but a searchBar is appear in maximum height on the _scrollView... So I add an RACObserve on
searchBar.process
like:Logs:
The searchBar's process snapped to 1, the then confusedly snapped back to 0....
The text was updated successfully, but these errors were encountered: