Code Monkey home page Code Monkey logo

egotableviewpullrefresh's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

egotableviewpullrefresh's Issues

About the function -- egoRefreshScrollViewDidScroll:

The realize of function as fellow:

  • (void)egoRefreshScrollViewDidScroll:(UIScrollView *)scrollView {

    if (_state == EGOOPullRefreshLoading) {

    CGFloat offset = MAX(scrollView.contentOffset.y * -1, 0);
    offset = MIN(offset, 60);
    scrollView.contentInset = UIEdgeInsetsMake(offset, 0.0f, 0.0f, 0.0f);
    

    } else if (scrollView.isDragging) {

    BOOL _loading = NO;
    if ([_delegate respondsToSelector:@selector(egoRefreshTableHeaderDataSourceIsLoading:)]) {
        _loading = [_delegate egoRefreshTableHeaderDataSourceIsLoading:self];
    }
    
    if (_state == EGOOPullRefreshPulling && scrollView.contentOffset.y > -65.0f && scrollView.contentOffset.y < 0.0f && !_loading) {
        [self setState:EGOOPullRefreshNormal];
    } else if (_state == EGOOPullRefreshNormal && scrollView.contentOffset.y < -65.0f && !_loading) {
        [self setState:EGOOPullRefreshPulling];
    }
    
    if (scrollView.contentInset.top != 0) {
        scrollView.contentInset = UIEdgeInsetsZero;
    }
    

    }

}

if I am not add the condition of "scrollView.isDragging", like that

  • (void)egoRefreshScrollViewDidScroll:(UIScrollView *)scrollView {

    if (_state == EGOOPullRefreshLoading) {

    CGFloat offset = MAX(scrollView.contentOffset.y * -1, 0);
    offset = MIN(offset, 60);
    scrollView.contentInset = UIEdgeInsetsMake(offset, 0.0f, 0.0f, 0.0f);
    

    } else {

    BOOL _loading = NO;
    if ([_delegate respondsToSelector:@selector(egoRefreshTableHeaderDataSourceIsLoading:)]) {
        _loading = [_delegate egoRefreshTableHeaderDataSourceIsLoading:self];
    }
    
    if (_state == EGOOPullRefreshPulling && scrollView.contentOffset.y > -65.0f && scrollView.contentOffset.y < 0.0f && !_loading) {
        [self setState:EGOOPullRefreshNormal];
    } else if (_state == EGOOPullRefreshNormal && scrollView.contentOffset.y < -65.0f && !_loading) {
        [self setState:EGOOPullRefreshPulling];
    }
    
    if (scrollView.contentInset.top != 0) {
        scrollView.contentInset = UIEdgeInsetsZero;
    }
    

    }

}
what is the matter with it? What the potential bug will be?

Refresh-Animation with Button

Hi,

im using the current Version of EGOTableViewPullRefresh with a UITableView and and the refresh via scrolling works perfectly.

But I have a UISegmentedControl- Button in my UITableViewController and I want to refresh the table when the segment is changed with the Pull-Animation

I do it with the following code:

self.tableView.contentInset = UIEdgeInsetsMake(66.0f, 0.0f, 0.0f, 0.0f);
[_refreshHeaderView egoRefreshScrollViewDidEndDragging: self.tableView];

The Problem is: It only works only once. On the second call, the Animation stops when the inset shows "Pull down to refresh".

Is there a better way to call the refreshanimation programmatically?

I'm using iOS 5 an ARC.

Last cell in table is only visible when dragging and holding the table

I found that las last cell(s) of my table was not shown within the region of the table that snaps to the visible area. I solved that by setting a footer view that matches the pullDownView:

In initWithFrame of EGOTableViewPullRefresh:

UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 90.0f)];
self.tableFooterView=footer;
[footer release];

Thanks for a nice piece of code.

Bug in Demo and fix for iPad width.

In the RootViewController of the demo, in the viewDidLoad: method you create your EGORefreshTableHeaderView view inside the if statement and then outside the scope of the if statement you send it refreshLastUpdatedDate.

I fixed this and got it to compile by defining view outside of the if statement. (EGORefreshTableHeaderView *view = nil;)

When you're creating the EGORefreshTableHeaderView view you set the width to 320 pixels hardcoded I noticed it getting cut off on the iPad so I changed it to self.tableView.bounds.size.width. Works perfectly.

Great stuff otherwise!

Can't have hardcoded state texts

If you have several lists, which each need to have different state texts, try this:

Header:
NSArray *stateText;
@Property (nonatomic, copy) NSArray *stateText;

Code:
-(void)setState
{
case EGOOPullRefreshPulling:
if (self.stateText)
statusLabel.text = [self.stateText objectAtIndex:0];
else
statusLabel.text = @"Release to refresh...";
...
}
- (void)dealloc
{
[stateText release]; stateText = nil;
Use:
refreshHeaderView.stateText = [NSArray arrayWithObjects:
@"Release", @"Pull", @"Load", nil];

cannot complie

When building I get:
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1

README file is empty

Bug, missing offset from navigation bar

Hi,

Has anyone experienced similar issues?

The scrollView scrolls up too much and the first section header of the table is "hidden"

I had to apply a dirty fix,

- (void)egoRefreshScrollViewDataSourceDidFinishedLoading:(UIScrollView *)scrollView {   

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:.3];
    // !!!! dirty fix !!!!
    [scrollView setContentInset:UIEdgeInsetsMake(60.0f, 0.0f, 0.0f, 0.0f)];
    [UIView commitAnimations];

    [self setState:EGOOPullRefreshNormal];

}

How to add EGORefresh below UIview of tableview header?

Hii ,

Thanks for this awesome Library ,

i have a top view as headerview to tableview and also have egorefresh , but i need ego refresh will available below the UIview of header view of tableview ?

now its like coming above EgoRefresh - > UIView -> tableview
is this possible and pls how - i tried to change y pos , height but its not setting correctly?

Thanks once again.

crash on scrolling distance

my app goes to crash if i scroll my tableview little bit more but it works fine for normal scrolling..any body help plz....

Section titles stop at the wrong location

Because 'contentInset' is used to adjust the padding when loading data the section headers are also pushed down by the same amount.

Another symptom of the same issue is when using 'sectionIndexTitlesForTableView' to show an index down the right side, the index gets squashed down by the contentInset amount.

Screenshot below. Notice the "A" section header has stopped because it thinks its reached the top of the scrollview and the sectionIndex has been squashed down too.

http://i.imgur.com/divYk.png

Load more

Can this work with a load more cell at the bottom of the table? I used this and it works great. Then I created a load more cell at the bottom of my table and now the pull doesn't work anymore. Is there a way to reset the

Datetime locale

Maybe it would be nicer for international users to use the locale of the iPhone. I think this would work well:

  • (void)setCurrentDate {
    [NSDateFormatter setDefaultFormatterBehavior:NSDateFormatterBehavior10_4];
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setDateStyle:NSDateFormatterMediumStyle];
    [formatter setTimeStyle:NSDateFormatterShortStyle];

    lastUpdatedLabel.text = [NSString stringWithFormat:@"Last Updated: %@", [formatter stringFromDate:[NSDate date]]];
    [[NSUserDefaults standardUserDefaults] setObject:lastUpdatedLabel.text forKey:@"EGORefreshTableView_LastRefresh"];
    [[NSUserDefaults standardUserDefaults] synchronize];
    [formatter release];
    }

iOS 5 must be __unsafe_unretained

I brought the code into my project which is sdk 5. I got rid of the obvious errors complaining about the "release" errors, but the last one I can't figure out. I'm getting "Existing ivar '_delegate' for unsafe_unretained property 'delegate' must be __unsafe_unretained"

I've tried every combination I could think of within the EGORefreshTableHeaderView.h; adding __unsafe_unretained, removing assign, etc... Has someone done this yet? I'm sure it's a fairly easy change, I'm just new to coding for iPhone and can't figure it out.

id _delegate; : 'delegate with assign attribute must be __unsafe_unretained'

Hi there,

In EGORefreshTableHeaderView.h, the line "id _delegate;" keeps throwing me the following error:

delegate with assign attribute must be __unsafe_unretained

Does anyone know how I can fix this? I was under the impression that the following property would keep this error from occurring:

@Property (nonatomic,assign) id delegate;

Thanks,
Brittany

Animation and sound ?

Hi, its not really a bug,

but it would be great to have a sound on refresh like in tweetie app.

Thank you very much for sharing !!

Text and image is invisible when integrated AMBubbleTableViewController

i integrated EGOTableViewPullRefresh and AMBubbleTableViewController in the app (build sdk: iOS 6.1)

but the text(like "Release to refresh...") and image is invisible

could you confirm that it is possible for using EGOTableViewPullRefresh and AMBubbleTableViewController in one table view ?

if yes, could you give me some suggestions ?

Thank you !

Missing README and LICENSE information

Dear enormego.
Thank you for a great code sample.

I think you deserve some acknowledgment for this great job.

Another important thing is a license, which is missing. Many developers may be confused whether it is legal to use this code in their commercial projects.

I suggest using MIT or BSD license.

Force a manual refresh

I'd like to force a refresh (espcially on the first load of the app) to indicate to the user that it is loading, as well as let them know about the "pull down to refresh" area (they will see it, and I believe "get the idea") -- I did this on my own with a method that does the scrolling, sets the state, and calls the reload, but is there a better way? Or should I just put my code up?

Problems with Navigation Controller

I created a UITableViewController following the DEMO.
The only different is that I added it inside an UINavigationController.

So when an user clicks a row, I have another view via:

    [self.navigationController pushViewController:anotherUITableViewController animated:YES];

When users select BACK, my first row of the table goes below the navigation bar. If I pull it down, I can see it.

Before pushViewController
self.view.bounds.size.height=367
self.view.bounds.size.width=320
self.view.bounds.origin.x=0
self.view.bounds.origin.y=0
self.tableView.bounds.size.height=367
self.tableView.bounds.size.width=320
self.tableView.bounds.origin.x=0
self.tableView.bounds.origin.y=0

After pushViewController
self.view.bounds.size.height=411
self.view.bounds.size.width=320
self.view.bounds.origin.x=0
self.view.bounds.origin.y= -44
self.tableView.bounds.size.height=411
self.tableView.bounds.size.width=320
self.tableView.bounds.origin.x=0
self.tableView.bounds.origin.y= -44

Do you have any idea where is the problem, please?

Full code can be found here: https://github.com/openphoto/mobile-ios/blob/master/OpenPhoto/TagViewController.m

Thanks

ios8下拉闪烁

在ios8下,egoRefreshScrollViewDidEndDragging的时候,scrollView.contentInset = UIEdgeInsetsMake(60.0f, 0.0f, 0.0f, 0.0f); 会触发egoRefreshScrollViewDidScroll 方法,scrollView.contentOffset.y的值变为60,然后恢复为原先推动的高度值。这个过程会导致跳动闪烁。

可以增加异步调整。
dispatch_async(dispatch_get_main_queue(), ^{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.2];
scrollView.contentInset = UIEdgeInsetsMake(60.0f, 0.0f, 0.0f, 0.0f);
[UIView commitAnimations];
});

Something wrong when EGOTable as a child view in NavigationController

when EGOTable view controller push to NavigationController and pull down the scroll to the bottom then back to pre view controller,the method - (void)scrollViewDidScroll:(UIScrollView *)scrollView will still be executed so error
occurred like this ---- scrollViewDidScroll:]: message sent to deallocated instance

License for this code?

Do you give permission for people to use this code under an Open Source license? If so, could you update the Readme, or the headers on the code file to indicate the license. I'd like to use this code in an app and would gladly give credit in the app's credit page. If you use an MIT license, that would be short and simple.

Thanks!

Does not always display when tableview created in UIViewController

This was working perfectly when I used it with a UITableViewController. But I am now trying to use it in a UIViewController, where I programmatically create the tableView. Most of the time the refresh header does not get shown, although a white area does get pulled down, and stays down while the view is refreshing.

When it does show, my table view header (not EGO) gets created twice, and the refresh header gets shown below the top duplicate header. However, even when removing my header it does not show properly.

Here is a screenshot:

https://lh6.googleusercontent.com/-eUGkPqmO4eE/Tm5OqoUBQvI/AAAAAAAABM4/ctJPGAZnEc4/s800/PulldownRefreshBug.png

iPad support

I recognize that it's not working when your Demo App is on iPad -
It would be quite appreciated if you add iPad support.

Class error

I'm getting this after adding this code to my project. And CALayer and other Core graphic things isn't purple, but black.
Can you help me?

"OBJC_CLASS$_RefreshTableHeaderView", referenced from:
objc-class-ref-to-RefreshTableHeaderView in OrdersViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

Bug when datasource is not available

Hello,

when I replace
[self performSelector:@selector(doneLoadingTableViewData) withObject:nil afterDelay:3.0];
with
[self performSelector:@selector(doneLoadingTableViewData)];
in

  • (void)egoRefreshTableHeaderDidTriggerRefresh:(EGORefreshTableHeaderView*)view

the view stays always in loading mode. This can happen for instance if you load something from the web and the device has no connection and therefore there's nothing to reload.

EGOTableViewPullRefresh with Storyboard?

Hi, I have a question about this great project. Does EGOTableViewPullRefresh works with Storyboards? I tried to implement this project using storyboards but I keep getting this error

"Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "2-view-3" nib but didn't get a UITableView.'"

Thanks

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.