Swift tableview自带的刷新控件

import UIKit
class ViewController: UIViewController,UITableViewDelegate,UITableViewDataSource {
let tableview = UITableView(frame: ScreenRect, style: .plain)
let refreshControl = UIRefreshControl()
let cell = "cell"
var arraymutable = ["","","","",""]
let array = ["","","",""]
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = #colorLiteral(red: , green: , blue: , alpha: )
CreatUi()
// Do any additional setup after loading the view.
}
func CreatUi(){
tableview.separatorStyle = .singleLine
tableview.backgroundColor = #colorLiteral(red: , green: , blue: , alpha: )
tableview.delegate = self
tableview.dataSource = self
tableview.tableFooterView = UIView()
tableview.refreshControl = refreshControl
refreshControl.backgroundColor = UIColor.gray
refreshControl.attributedTitle = NSAttributedString(string: "刷新一下:\(NSDate())", attributes: [NSForegroundColorAttributeName:UIColor.white])//设置文字颜色
refreshControl.tintColor = UIColor.green //小菊花的颜色
refreshControl.tintAdjustmentMode = .dimmed //色彩调整模式
refreshControl.addTarget(self, action: #selector(addcount), for: .valueChanged)
view.addSubview(tableview)
}
func addcount(){
arraymutable.append(contentsOf: array)
tableview.reloadData()
refreshControl.endRefreshing()
}
override var preferredStatusBarStyle: UIStatusBarStyle{
return .default
}
//tableview 代理
func numberOfSections(in tableView: UITableView) -> Int {
return
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return arraymutable.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let celll = tableView.dequeueReusableCell(withIdentifier: cell) ?? UITableViewCell(style: .default, reuseIdentifier:cell)
celll.textLabel?.text = arraymutable[indexPath.row]
celll.textLabel?.textColor = UIColor.red
celll.textLabel?.font = UIFont.boldSystemFont(ofSize: )
return celll
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
Swift tableview自带的刷新控件的更多相关文章
- [Swift通天遁地]二、表格表单-(4)使用系统自带的下拉刷新控件,制作表格的下拉刷新效果
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...
- SYRefresh 一款简洁易用的刷新控件 支持tableview,collectionview水平垂直刷新功能
SYRefresh 地址: https://github.com/shushaoyong/SYRefresh 一款简洁易用的刷新控件 示例程序: 默认刷新控件使用方法: //添加头部刷新控件 Sc ...
- 与TableView插入、删除、移动、多选,刷新控件
一.插入.删除.移动.多选 方法一: Cell的插入.删除.移动都有一个通用的方法,就是更新tableView的数据源,再reloadData,这样做实现上是简单一点,但是reloadData是刷新整 ...
- 上拉加载下拉刷新控件WaterRefreshLoadMoreView
上拉加载下拉刷新控件WaterRefreshLoadMoreView 效果: 源码: // // SRSlimeView // @author SR // Modified by JunHan on ...
- iOS:下拉刷新控件UIRefreshControl的详解
下拉刷新控件:UIRefreshControl 1.具体类信息: @interface UIRefreshControl : UIControl //继承控制类 - (instancetype)ini ...
- 自定义下拉刷新控件-CBStoreHouseRefreshControl
本文转载至 http://www.cocoachina.com/ios/20141110/10177.html iOS开发自定义刷新CBStoreHouseRefres 介绍 这是一款在Storeho ...
- ios--->上下拉刷新控件MJRefresh
上下拉刷新控件MJRefresh 一.类结构 MJRefreshComponent.h MJRefreshHeader.h MJRefreshFooter.h MJRefreshAutoFooter. ...
- 【Android】SwipeRefreshLayout的简单使用教程。下拉刷新控件炫酷效果。
作者:程序员小冰,GitHub主页:https://github.com/QQ986945193 新浪微博:http://weibo.com/mcxiaobing 首先给大家看一下我们今天这个最终实现 ...
- android官方下拉刷新控件SwipeRefreshLayout的使用
可能开发安卓的人大多数都用过很多下拉刷新的开源组件,但是今天用了官方v4支持包的SwipeRefreshLayout觉得效果也蛮不错的,特拿出来分享. 简介:SwipeRefreshLayout组件只 ...
随机推荐
- Linux指令 vi编辑,保存及退出
编辑模式 使用vi进入文本后,按i开始编辑文本退出编辑模式 按ESC键,然后: 退出vi :q! 不保存文件,强制退出vi命令 :w 保存文件,不退出vi命令 :wq 保存文件,退出vi命令 中断vi ...
- Hadoop实战训练————MapReduce实现PageRank算法
经过一段时间的学习,对于Hadoop有了一些了解,于是决定用MapReduce实现PageRank算法,以下简称PR 先简单介绍一下PR算法(摘自百度百科:https://baike.baidu.co ...
- 使用Navicat导入.csv文件(过程和注意点)
1.创建一个数据库,右键点击表,选择导入向导. 2.在跳出的弹窗中选择.CSV文件,点击下一步 3.选择文件来源和编码规格,点击下一步 如果发现上传后中文出现乱码请使用10008这个编码规则 4.选择 ...
- Django的ModelForm组件
创建类 from django.forms import ModelForm from django.forms import widgets as wd from app01 import mode ...
- javaWeb开发中关于eclipse等ide重新部署或重启项目等原因造成上传文件丢失问题解决方案
在开发项目时,有时候需要用到上传功能,比如头像上传等,其文件会保存到服务器中.但是我发现在用eclipse做项目的过程中,每次重新部署项目,原来上传的文件就会丢失. 其原因是因为每次项目修改后,ecl ...
- 04.redis集群+SSM整合使用
redis集群+SSM整合使用 首先是创建redis-cluster文件夹: 因为redis最少需要6个节点(三主三从),为了更好的理解,我这里创建了两台虚拟机(192.168.0.109 192.1 ...
- redis函数总结
<?php /*1.Connection*/ $redis = new Redis(); $redis->connect('127.0.0.1',6379,1);//短链接,本地host, ...
- javassist:字节码编辑器工具
简介: javassist是一款可以在运行时生成字节码的工具,可以通过它来构造一个新的class对象.method对象,这个class是运行时生成的.可以通过简短的几行代码就可以生成一个新的class ...
- C# Dictionary根据Key排序
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Cons ...
- day1 python基础知识
一:python发展 python2.6与python3.0区别: 源码不标准,混乱,重复代码过多 二:python所属类型 (1)编译型:一次性将程序全部编译成二进制 优点:运行速度快 缺点:不能跨 ...