0
func loadMoreData(offset: Int, completion: (result: [ArtistJSONMapper]?) -> Void) {

    var fetchedData = [ArtistJSONMapper]()
    let pageNum: Int = offset/paging.limit

    // Calling the json fetch to obtain data

    JSONFetch.jsonTest() { (fetched, error) -> Void in
        if(fetched != nil) {
            fetchedData = fetched!
            //self.tableView.reloadData()

        } else {
            println("error - \(error)")
        }
    }

    println("Fetched data count is \(fetchedData.count)")
    completion(result: fetchedData.count > 0 ? fetchedData : nil)

}

我正在使用 AlamofireObjectMapper 使用 JSONFetch.jsonTest() 方法获取数据。现在的问题是如何从我的控制器调用这个 loadMoreData ?

4

1 回答 1

0

我在这里实现尾随关闭

loadMoreData(2){ (result) in

//after completion of your work this closure gets called
 println("your return \(result)")


}
于 2015-08-04T06:21:55.793 回答