2014-11-24 80 views
1

在swift代碼庫上使用SVPullToRefresh + SVInfiniteScrolling。我怎樣寫SVPullToRefresh + SVInfiniteScrolling in Swift code

[tableView addPullToRefreshWithActionHandler:^{ 
    // prepend data to dataSource, insert cells at top of table view 
    // call [tableView.pullToRefreshView stopAnimating] when done 
}]; 

[tableView addPullToRefreshWithActionHandler:^{ 
    // prepend data to dataSource, insert cells at top of table view 
    // call [tableView.pullToRefreshView stopAnimating] when done 
} position:SVPullToRefreshPositionBottom]; 
在SWIFT代碼

回答

1

嘗試類似:

self.tableView.addPullToRefreshWithActionHandler({() -> Void in 
    //code  
}) 
1
myTableView.addPullToRefreshWithActionHandler({() -> Void in 

} 

記得SVPullToRefresh添加到您的清創頭文件如「MyProject的橋接,Header.h

#import <SVPullToRefresh/SVPullToRefresh.h> 
0
tableView.addPullToRefreshWithActionHandler { 

} 
0

可以是:

myTableView.addPullToRefresh(actionHandler: { 

}) 

myTableView.addInfiniteScrolling(actionHandler: 
      {() -> Void in 

     }) 

雨燕現切的第一個參數的名字從函數名以及由羅伯特提到你需要包括這一點。您的橋接文件中的標題。