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