Reactive Cocoa - View visibility based on scrollview content offset -


Based on the current offset off value of ScrollView, I am trying to change the visibility of a view using reactive cocoa . My idea was to create a supervisor on an NSNumber property that would be converted into scrollviewdisk of the ScrollviewView. Here is the code that I added to ViewDidLoad:

  RAC (see title itself, hidden) = [RACObserve (self, offset) subscribeNext: ^ (NSNumber * value) {return @ ([ Value integer value]> 0); }];  

Setting a breakpoint on the return statement, I think it's called once, but never again.

The solution that you describe, executes a method that calls - SendNext: On a topic, is so common that this is a way for you: -rac_signalForSelector: . In the case of the representative, you can call the representative at -rac_signalForSelector: , like:

  RAC (self.headerView, hidden) = [[(ID) ScrollView.delegate rac_signalForSelector: @selector (scrollViewDidScroll :)) Minimize: ^ (UIScrollView * scrollView) {return @ (scrollView.contentOffset.y> 0); }];  

Comes with delegates One caught hold is that you must ensure that you -rac_signalForSelector: before the call representative Are assigned to.


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -