func dataJsonFromURL(url:String)->NSArray{ if let data = NSData(contentsOfURL: NSURL(string: url)!) { return ((try! NSJsONSerialization.JsONObjectWithData(data,options: [])) as! NSArray) } else{ return data }}func tableVIEw(tableVIEw: UItableVIEw,cellForRowAtIndexPath indexPath: NSIndexPath) -> UItableVIEwCell{ let cell = tableVIEw.dequeueReusableCellWithIDentifIEr("NCell",forIndexPath: indexPath) as! tableVIEwCell22 cell.backgroundcolor = UIcolor .clearcolor() let mindata = (data[indexPath.row] as! NSDictionary)}你必须使用这种方法
overrIDe func tableVIEw(tableVIEw: UItableVIEw,willdisplayCell cell: UItableVIEwCell,forRowAtIndexPath indexPath: NSIndexPath) { let lastElement = dataSource.count - 1 if indexPath.row == lastElement { // handle your logic here to get more items,add it to dataSource and reload tablevIEw } }总结
以上是内存溢出为你收集整理的swift – 当滚动到底部时,UITableView加载更多全部内容,希望文章能够帮你解决swift – 当滚动到底部时,UITableView加载更多所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)