Programmatically show TTTableHeaderDragRefreshView's Pull Down to Update Message

How do you programmatically show this message using three20's TTTableHeaderDragRefreshView? (Though this example is not from three20)

Can I control the scrolling to scroll to the top with a little negative y value, just to show that message: "Pull Down to Update/Refresh?"

Answers


Yes, you will have to change the content offset of the table manually and call the table's reload function. this will create the same effect the user sees when he tries to update the content by scrolling to the top of the table:

///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)reload {
  if ([self.tableView.delegate isKindOfClass:[TTTableViewDragRefreshDelegate class]]) {
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:ttkDefaultFastTransitionDuration];
    self.tableView.contentOffset = CGPointMake(0, -60.0f);
    [UIView commitAnimations];
  }

  [super reload];
}

and then, just add a button to use this reload function:

self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(reload)] autorelease];

You might need also to invalidate your datasource, to force the update, because if the data is stored in the cache, the drag to refresh will appear and hide immediately.


Need Your Help

how to add knockout validation to a previously not required field

knockout.js knockout-validation

I have a simple knockout viewmodel with an array of passengers in it. Each passenger has, firstname, lastname and number properties. The number field for each passenger is not mandatory unless they

OpenMP and CPU affinity

c++ c posix openmp

Will sched_setaffinity or pthread_attr_setaffinity_np work to set thread affinity under OpenMP?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.