Giter Club home page Giter Club logo

Comments (9)

samvermette avatar samvermette commented on August 29, 2024

Please describe "doesn't work".

from svpulltorefresh.

emile818 avatar emile818 commented on August 29, 2024
if( [theWebView respondsToSelector:@selector(scrollView)] ) {
    UIScrollView *sv =  [theWebView performSelector:@selector(scrollView)];

    [sv addPullToRefreshWithActionHandler:^{
        //[sv.pullToRefreshView performSelector:@selector(stopAnimating) withObject:nil afterDelay:2];
        [self.webView stringByEvaluatingJavaScriptFromString:@"function (){  console.log ('refresh fired....')   }"];

    }];
    [sv addInfiniteScrollingWithActionHandler:^{
        [self.webView stringByEvaluatingJavaScriptFromString:@"function (){  console.log ('load more data, infinite scroll fired....')   }"];
    }];

}
else
{
    NSLog(@"ios 4");
    for( UIScrollView *sv in [theWebView subviews] ) {
        if( [sv isKindOfClass:[UIScrollView class]] ) {

            [sv addPullToRefreshWithActionHandler:^{
                //[sv.pullToRefreshView performSelector:@selector(stopAnimating) withObject:nil afterDelay:2];
                [self.webView stringByEvaluatingJavaScriptFromString:@"signal.app.refreshCurrentView()"];

            }];
            [sv addInfiniteScrollingWithActionHandler:^{
                [self.webView stringByEvaluatingJavaScriptFromString:@"signal.app.loadMoreContentToCurrentView()"];
            }];
            break;
        }
    }
}



// more: 
            // sv is the scroll view of the webview, you can access like the code above, i will do a proper documentation when i have some free time 
            sv.showsPullToRefresh = NO;    
            [sv.pullToRefreshView stopAnimating];

from svpulltorefresh.

samvermette avatar samvermette commented on August 29, 2024

@emile818 thanks for helping out and for the nice tweet about SVPullToRequest :)

from svpulltorefresh.

emile818 avatar emile818 commented on August 29, 2024

@samvermette keep it up, i am using most of your plugins in my phonegap app. thanks again :)

from svpulltorefresh.

samvermette avatar samvermette commented on August 29, 2024

@emile818 by the way, does your addInfiniteScrollingWithActionHandler: code sample actually work? The way I did it, it should only work with table views because it's setting the view as the UITableView's tableFooterView. Not the case with the pull to refresh part, since it's only adding the view at the top of scroll view.

I was actually thinking of dropping the UIScrollView support and making it UITableView only but this particular issue is giving me second thoughts...

from svpulltorefresh.

emile818 avatar emile818 commented on August 29, 2024

@samvermette i forgot to mention that i commented [(UITableView*)self.scrollView setTableFooterView:self] here https://github.com/samvermette/SVPullToRefresh/blob/master/SVPullToRefresh/SVPullToRefresh.m#L200 and here https://github.com/samvermette/SVPullToRefresh/blob/master/SVPullToRefresh/SVPullToRefresh.m#L241
And what i am doing i am adding an html loading message at the bottom of the html.

I did it this way to move fast, however i think we can add/remove an activity indicator view after the scrollView

from svpulltorefresh.

emile818 avatar emile818 commented on August 29, 2024

@samvermette It's so weird that went i install the application from a testflight SVPullToRefresh crashes all the time
The same build installed from xcode works fine,
i am using -fobjc-arc compile flag since my project is not arc

0 xx 0x0005ee22 testflight_backtrace + 158
1 xx 0x0005fa4c TFSignalHandler + 244
2 libsystem_c.dylib 0x32f057ec _sigtramp + 48
3 xx 0x0002d94a -SVPullToRefresh setState:
4 xx 0x0002d0e6 -SVPullToRefresh scrollViewDidScroll:
5 xx 0x0002ccbc -SVPullToRefresh observeValueForKeyPath:ofObject:change:context:
6 Foundation 0x355a413e NSKeyValueNotifyObserver + 258
7 Foundation 0x355a3da4 NSKeyValueDidChange + 324
8 Foundation 0x3557a996 -[NSObject(NSKeyValueObserverNotification) didChangeValueForKey:] + 94

What do you think?

from svpulltorefresh.

emile818 avatar emile818 commented on August 29, 2024

I found it,

it was a pullToRefreshActionHandler = [actionHandler copy] vs pullToRefreshActionHandler = actionHandler;

i wasn't using the latest version of the code my version was still using pullToRefreshActionHandler = actionHandler; which was causing a crash in release mode.

from svpulltorefresh.

samvermette avatar samvermette commented on August 29, 2024

@emile818 yikes! Good thing that it's fixed now but I hope not too many devs will stumble on this.

from svpulltorefresh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.