Giter Club home page Giter Club logo

pulltorefreshview's Issues

statusLabel is not showing

When I use this with UIWebView, statusLabel is not showing.
Adding following code in initWithScrollView fix this issue.
statusLabel.frame = CGRectMake(0.0f, frame.size.height - 50.0f, self.frame.size.width, 20.0f);

version: 5405a50
iPhone 5.1 Simulator
Xcode 4.3.1

Issue with tableview

I tried to add this to my tableview.
I can see the arrow on top of the tableview, but the arrow isn't rotating or anything. I think it isn't recognizing my tableview as a scrollview. How can i fix that?

In UIWebView

Hi,
Would be interesting to put it in a UIWebView.

Issue with UIWebView

The latest version (5405a50) doesn't work with UIWebView.
state never be set and pullToRefreshViewShouldRefresh never be triggered.
Adding 'state = kPullToRefreshViewStateNormal;' in initWithScrollView makes this work with UIWebView.

iPhone 5.1 Simulator
Xcode 4.3.1

Problem with pulltorefrensh

There is a problem with pulltorefresh when you try to zoom-in the scrollview or other object
example: yfrog.com/klxvvp

Fixed the statusLabel not showing and added init state

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

  • (id)initWithScrollView:(UIScrollView *)scroll {
    CGRect frame = CGRectMake(0.0f, 0.0f - scroll.bounds.size.height, scroll.bounds.size.width, scroll.bounds.size.height);

    if ((self = [super initWithFrame:frame])) {

    //...................

    statusLabel = [[UILabel alloc] init];
    //add by yager
    statusLabel.frame = CGRectMake(0.0f, frame.size.height - 48.0f, self.frame.size.width, 20.0f);
    statusLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
    statusLabel.font = [UIFont systemFontOfSize:12.f];
    statusLabel.textColor = kPullToRefreshViewTitleColor;
    statusLabel.shadowColor = [UIColor colorWithWhite:0.9f alpha:1.0f];
    statusLabel.shadowOffset = CGSizeMake(0.0f, 1.0f);
    statusLabel.backgroundColor = [UIColor clearColor];
    statusLabel.textAlignment = UITextAlignmentCenter;
    [self addSubview:statusLabel];
    

    //...................

    //add by yager
    [self setState:kPullToRefreshViewStateNormal];
    

    }

    return self;
    }

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Pull-to-refresh window doesn't disappear

I implemented everything into my rss reader, but after bulling the tableview down, the loading window doesn't disappear anymore.

import "RssFunViewController.h"

import "BlogRssParser.h"

import "BlogRss.h"

import "GYSAAppDelegate.h"

@implementation RssFunViewController

@synthesize rssParser = _rssParser;
@synthesize tableView = _tableView;
@synthesize appDelegate = _appDelegate;
@synthesize toolbar = _toolbar;

-(void)toolbarInit{
UIBarButtonItem *refreshButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh
target:self action:@selector(reloadRss)];
refreshButton.enabled = NO;
NSArray *items = [NSArray arrayWithObjects: refreshButton, nil];
[self.toolbar setItems:items animated:NO];
[refreshButton release];
}

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.

  • (void)viewDidLoad {
    [super viewDidLoad];
    [self toolbarInit];
    _rssParser = [[BlogRssParser alloc]init];
    self.rssParser.delegate = self;
    [[self rssParser]startProcess];
    pull = [[PullToRefreshView alloc] initWithScrollView:_tableView];
    [pull setDelegate:self];
    [_tableView addSubview:pull];
    }

// called when the user pulls-to-refresh

  • (void)pullToRefreshViewShouldRefresh:(PullToRefreshView *)view {
    [[self tableView]reloadData];
    }
  • (void)finishedLoading {
    //reload the table view
    [[self tableView]reloadData];
    }

-(void)toggleToolBarButtons:(BOOL)newState{
NSArray *toolbarItems = self.toolbar.items;
for (UIBarButtonItem *item in toolbarItems){
item.enabled = newState;
}
}

  • (void)processCompleted{
    //reload the table view
    [self toggleToolBarButtons:YES];
    [[self tableView]reloadData];
    }

//Delegate method for blog parser will get fired when the process is completed

-(void)processHasErrors{
//Might be due to Internet
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Achtung!" message:@"Leider ist es im Moment nicht möglich eine Verbindung zum Internet herzustellen."
delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
[alert release];
[self toggleToolBarButtons:YES];
}

  • (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return [[[self rssParser]rssItems]count];
    }
  • (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"rssItemCell"];
    if(nil == cell){
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"rssItemCell"]autorelease];
    }
    cell.textLabel.text = [[[[self rssParser]rssItems]objectAtIndex:indexPath.row]title];
    cell.detailTextLabel.text = [[[[self rssParser]rssItems]objectAtIndex:indexPath.row]description];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    return cell;
    }
  • (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [[self appDelegate] setCurrentlySelectedBlogItem:[[[self rssParser]rssItems]objectAtIndex:indexPath.row]];
    [self.appDelegate loadNewsDetails];
    [_tableView deselectRowAtIndexPath:indexPath animated: YES];
    }
  • (void)viewDidUnload {
    pull=nil;
    [PullToRefreshView release];
    }
  • (void)dealloc {
    [_appDelegate release];
    [_toolbar release];
    [_tableView release];
    [_rssParser release];
    [PullToRefreshView release];
    [super dealloc];
    }

@EnD

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.