2011-07-18 50 views
0

当TTTableViewController中的连接超时时,是否有办法让拉动刷新?当用户超时时,似乎用户无法做任何事情。请咨询当连接超时时刷新

回答

1

我会采取其他措施来解决这个问题。如果有表中没有的内容,我显示在UINavigationBar的刷新按钮,手动调用拉刷新委托:

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

您可以隐藏rightbarbuttonitem如果数据源已成功加载。

+0

但用户将不得不按下此按钮吗?刷新它?问题是我有我的右栏按钮项目已经使用 – adit

+0

我也有一个右键在UINavigationBar,但我没有数据时重写它 – aporat