1.创建tableview

    private lazy var cellId = "cellId"
fileprivate lazy var tv : UITableView = {
let tv = UITableView(frame: CGRect.zero, style: UITableView.Style.grouped)
tv.register(UITableViewCell.self, forCellReuseIdentifier: cellId)//注册cell
tv.translatesAutoresizingMaskIntoConstraints = false// VFL
tv.showsVerticalScrollIndicator = false//垂直滚动指示器
tv.showsHorizontalScrollIndicator = false//水平滚动指示器
tv.delegate = self
tv.dataSource = self
tv.bounces = false//弹簧效果
tv.separatorStyle = .none//分割线
tv.estimatedRowHeight = 0//预设行高
tv.estimatedSectionFooterHeight = 0//预设分区头高度
tv.estimatedSectionHeaderHeight = 0
tv.backgroundColor = UIColor.white
if #available(iOS 11.0, *) {
tv.contentInsetAdjustmentBehavior = UIScrollView.ContentInsetAdjustmentBehavior.never
}
return tv
}()

  

2.UICollectionView

let JYLoadImageCollectionCellId = "JYLoadImageCollectionCell"
let JYAddImageCollectionCellId = "JYAddImageCollectionCell"
private lazy var collectionView: UICollectionView = {
let layout = UICollectionViewFlowLayout()
let itemWidth = CGFloat(Int((JY_DEVICE_WIDTH - 10 * 4)/3))
let itemHeight = itemWidth
layout.itemSize = CGSize(width: itemWidth, height: itemHeight)
layout.minimumLineSpacing = 0
layout.minimumInteritemSpacing = 0
layout.sectionInset = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 10) let collectionV = UICollectionView(frame: CGRect.zero, collectionViewLayout: layout)
collectionV.translatesAutoresizingMaskIntoConstraints = false
// collectionV.register(UINib.init(nibName: "JYChooseShopTimeCollectionCell", bundle: nil), forCellWithReuseIdentifier: "JYChooseShopTimeCollectionCell")
collectionV.register(JYLoadImageCollectionCell.classForCoder(), forCellWithReuseIdentifier: JYLoadImageCollectionCellId)
collectionV.register(JYAddImageCollectionCell.classForCoder(), forCellWithReuseIdentifier: JYAddImageCollectionCellId)
collectionV.delegate = self
collectionV.dataSource = self
collectionV.backgroundColor = .white
collectionV.showsHorizontalScrollIndicator = false
collectionV.showsVerticalScrollIndicator = false return collectionV
}()

  

swift - 快速代码块 - 创建 tableview等一些控件 基本属性的更多相关文章

  1. winform快速开发平台 -> 基础组件之分页控件

    一个项目控件主要由及部分的常用组件,当然本次介绍的是通用分页控件. 处理思想:我们在处理分页过程中主要是针对数据库操作. 一般情况主要是传递一些开始位置,当前页数,和数据总页数以及相关关联的业务逻辑. ...

  2. Qt 创建一个QtDesinger第三方控件

    1.需要创建一个合适的.pro文件 2.创建一个继承QDesignerCustomWidgetInterface的类,描述控件的一些属性. 函数 描述和返回值 name() 指定控件的名称 group ...

  3. 【VS开发】使用MFC创建并调用ActiveX控件

    使用MFC创建并调用ActiveX控件 今天做了一下ActiveX的使用测试,总结一下: 首先使用MFC创建一个activeX的控件譬如ActiveXTest,编译成ocx并注册,然后另外编写一个测试 ...

  4. Zara带你快速入门WPF(4)---Command与功能区控件

    前言:许多数据驱动的应用程序都包含菜单和工具栏或功能区控件,允许用户控制操作,在WPF中,也可以使用功能区控件,所以这里介绍菜单和功能区控件. 一.菜单控件 在WPF中,菜单很容易使用Menu和Men ...

  5. 用ActiveX 创建自己的comboBox 控件(一)

    新建ActiveX工程ActiveXcomboBox        Ok->next->next->next, create control based on 选择combobox, ...

  6. iOS - Target-Action机制创建自己的UI控件需要了解的知识

    我们在开发应用的时候,经常会用到各种各样的控件,诸如按钮(UIButton).滑块(UISlider).分页控件(UIPageControl)等.这些控件用来与用户进行交互,响应用户的操作.我们查看这 ...

  7. iOS之分别使用代码和storyboard、xib为控件设置圆角(以按钮为例)

    首先我们看一下代码是如何给按钮设置圆角的: 我们再来看看如何在storyboard或xib中给按钮设置圆角: 1.在storyboard或xib中添加按钮后,设置标题和背景色,做好约束: 2.点击 S ...

  8. PDF创建及动态转换控件程序包ActivePDF Portfolio

    ActivePDF Portfolio是将4个activePDF最优秀的服务器产品捆绑成一个价格适中的控件程序包.它提供了开发一个完整的服务器端的PDF解决方案所需的一切. 具体功能: activeP ...

  9. C#把动态创建的多个控件中指定控件显示在最上层

    在创建多个控件后,有些控件会发生重叠,那么就需要在鼠标按下它时能显示在最上层,下面通过先将按下操作的控件删除然后再重建,就达到让它显示在最上层了 //控件按下 private void picture ...

随机推荐

  1. python流程控制for循环

    流程控制 for循环 #首先我们用一例子看下用while循环取出列表中值的方法 l=['a','b','c'] i=0 while i<len(l): print(l[i]) i+=1 #whi ...

  2. Zabbix邮件报警配置

    一.安装sendmail或者postfix yum install sendmail #安装 service sendmail start #启动 chkconfig sendmail on #设置开 ...

  3. docker的完整解决方案2

    这个解决方案很简单 使用docker自带的swarm 首先初始化集群 docker swarm init 然后其余节点加入集群,这个就不说,太简单了 集群初始化后,可以查看下集群状态 docker n ...

  4. MVC part3

    SpringMVC原理图 SpringMVC接口解释 DispatcherServlet接口: Spring提供的前端控制器,所有的请求都有经过它来统一分发.在DispatcherServlet将请求 ...

  5. (转)如何禁用Windows 10系统的触摸屏

    https://baijiahao.baidu.com/s?id=1593890738706748667 现在许多优质的Windows 10个人电脑都配备了触摸屏,因为触摸屏的日益普及,Windows ...

  6. js高级-闭包

    function foo(x){ var tmp = 3; return function(y){ //把一个函数作为返回值,定义时候的作用域 console.log(x+y+(++tmp)) //+ ...

  7. jq控制select值为某个时选中

    $("#selectche_type option").each(function(){//用id ,用class好像不得,不知道为何 alert(2) if($(this).va ...

  8. ssh架构之hibernate(二)进阶学习

    1.JPA入门 JPA的认识:JPA全称Java Persistence API.JPA通过JDK 5.0注解或XML描述对象-关系表的映射关系,并将运行期的实体对象持久化到数据库中Java持久层AP ...

  9. AssetBundle Manager

    [AssetBundle Manager] AssetBundleManager是一个款Unity公司制作的Unity库. 1.Simulation Mode The main advantage o ...

  10. pecan API调用

    1.在PasteDeploy部署caesar-api服务时,setup_app中建立app,app中设置hooks,hooks负责加载conf配置文件和数据库连接 self.storage_conne ...