Pull To Refresh - XCode Program (Please help!)

Discussion in 'iOS Programming' started by rebello95, Jun 15, 2011.

  1. rebello95 macrumors member

    Joined:
    Jun 15, 2011
    Location:
    USA
    #1
    Okay so I'm making an app that forwards to one of my websites. I'm trying to figure out how to make the Pull to Refresh have the webpage reload. I followed the instructions on https://github.com/leah/PullToRefresh and got to the last step, but I don't know what programming to put in the subclass. Can someone please help me? Thanks
     
  2. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #2
    Err, so what is your question exactly?

    It's calling a selector here -->
    Code:
     - (void)refresh {
        [self performSelector:@selector(addItem) withObject:nil afterDelay:2.0];
    }
    which is calling this methid -->

    Code:
    - (void)addItem {
        // Add a new time
        NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
        [dateFormatter setTimeStyle:NSDateFormatterMediumStyle];
        NSString *now = [dateFormatter stringFromDate:[NSDate date]];
        [items insertObject:[NSString stringWithFormat:@"%@", now] atIndex:0];
    
        [self.tableView reloadData];
    
        [self stopLoading];
    }
    So just change the code in there, play around with it, hint, there are some build in codes for webviews to reload!
     
  3. rebello95 thread starter macrumors member

    Joined:
    Jun 15, 2011
    Location:
    USA
    #3
    Well the thing is, I'm a new developer... I know which code to change but not what to change that code to. Does anyone know the code I need to make it refresh a webpage?
    Thanks
     
  4. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #4
    Have you looked at the instance methods in the UIWebView Class Reference?
     
  5. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #5
    I actually even gave u the hint.

    So like DEJO said, it's all there on the documentation. Or Command+double click on your UIWebvie variable.
     

Share This Page