我是编程新手。我成功解析了json数据并显示它。我想每天刷新数据,因此用户每次启动时都不会下载相同的数据。我无法为此找到有用的教程...
我的手机还有图像,有没有办法只保存图像?
由于
func refreshArticles(){
loadArticles()
}
let transitionManager = TransitionManager()
var articles: [JSON]? = []
var moreArticles: [JSON]? = []
var yazarinArticles: [JSON]? = []
func loadArticles(currentPage:Int=1){
let url = "http://abc" + String(currentPage)
Alamofire.request(.GET, url).responseJSON { (Request, response, json, error) -> Void in
if (json != nil){
var jsonObj = JSON(json!)
if let data = jsonObj["articles"].arrayValue as [JSON]?{
self.articles = data
self.tableView.reloadData()
self.view.hideLoading()
self.refreshControl?.endRefreshing()
self.title = "Makaleler"
}
}
}
}
override func viewDidLoad() {
super.viewDidLoad()
self.loadArticles()
}
}