开发者

refresh when connection timed out

开发者 https://www.devze.com 2023-03-21 07:46 出处:网络
Is there a way to enable the pull to refresh when I got a connection timed out in a TTTable开发者_JS百科ViewController? It seems that the user can\'t do anything at that point when it timed out. Pleas

Is there a way to enable the pull to refresh when I got a connection timed out in a TTTable开发者_JS百科ViewController? It seems that the user can't do anything at that point when it timed out. Please advice


I do something else to solve this issue. If there's no content in the table, I display a refresh button on the UINavigationBar which manually calls the pull to refresh delegate:

///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)viewDidAppear:(BOOL)animated {
  [super viewDidAppear:animated];

  if ([Stations count]==0) {
    self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] 
                                               initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh 
                                               target:self
                                               action:@selector(reload)] autorelease];
  }
}

///////////////////////////////////////////////////////////////////////////////////////////////////
- (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];
}

You can hide the rightbarbuttonitem if datasource was loaded successfully.

0

精彩评论

暂无评论...
验证码 换一张
取 消