import UIKit

class FirstVC: UIViewController,UITableViewDelegate,UITableViewDataSource {

    var tableView : UITableView?
var items = ["武汉","上海","武汉","上海","武汉","上海","武汉","上海"] override func viewDidLoad() {
super.viewDidLoad() initView() // Do any additional setup after loading the view.
} func initView(){ self.tableView = UITableView(frame:self.view.frame,style:UITableViewStyle.plain)
self.tableView!.dataSource = self
self.tableView!.delegate = self
self.tableView!.register(FirstCell.classForCoder(), forCellReuseIdentifier: "cell")
self.view.addSubview(self.tableView!)
self.tableView?.tableFooterView = UIView()
} func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { // let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
// cell.textLabel!.text = self.items[indexPath.row]
let cell:FirstCell! = tableView.dequeueReusableCell(withIdentifier: "cell") as! FirstCell!
cell.titles.text = self.items[indexPath.row] //去除cell阴影
cell.selectionStyle = UITableViewCellSelectionStyle.none return cell
} func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.items.count
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { print("点击cell的indexpath.row:\(items[indexPath.row])") let detail = First_detail_VC()
self.navigationController?.pushViewController(detail, animated: true) } override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}

swift-UITableView的更多相关文章

  1. Swift - UITableView展开缩放动画

    Swift - UITableView展开缩放动画 效果 源码 https://github.com/YouXianMing/Swift-Animations // // HeaderViewTapA ...

  2. Swift - UITableView状态切换效果

    Swift - UITableView状态切换效果 效果 源码 https://github.com/YouXianMing/Swift-Animations // // TableViewTapAn ...

  3. IOS SWIFT UITableView 实现简单微博列表

    // // Weibo.swift // UITableViewCellExample // // Created by XUYAN on 15/8/15. // Copyright (c) 2015 ...

  4. Swift - UITableView里的cell底部分割线左侧靠边

    override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, ...

  5. SWIFT UITableView的基本用法

    import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: ...

  6. Swift - UITableView的用法

    因为倾向于纯代码编码,所以不太喜欢可视化编程,不过也略有研究,所以项目里面的所有界面效果,全部都是纯代码编写! 终于到了重中之重的tableview的学习了,自我学习ios编程以来,工作中用得最多的就 ...

  7. Swift UITableView嵌套UICollectionView点击事件冲突(点击事件穿透)

    不管是啥都响应tableviewcell class JYShopCertificationCell: UITableViewCell { override func hitTest(_ point: ...

  8. iOS Swift 模块练习/swift基础学习

    SWIFT项目练习     SWIFT项目练习2 iOS Swift基础知识代码 推荐:Swift学习使用知识代码软件 0.swift中的宏定义(使用方法代替宏) 一.视图  +控件 1.UIImag ...

  9. IOS ViewTable

    // //  ViewController.swift //  UITableView // //  Created by lanou on 16/11/7. //  Copyright (c) 20 ...

  10. iOS播放器、Flutter高仿书旗小说、卡片动画、二维码扫码、菜单弹窗效果等源码

    iOS精选源码 全网最详细购物车强势来袭 一款优雅易用的微型菜单弹窗(类似QQ和微信右上角弹窗) swift, UITableView的动态拖动重排CCPCellDragger 高仿书旗小说 Flut ...

随机推荐

  1. 网站建设中帝国cms如何循环调用栏目下级分类

    类似的形式,调用下级分类 ?php $bclassid=[!--self.classid--]; //选择当前栏目的id,如果调用指定栏目下的多级分类,则填写栏目id //取得本栏目下的子栏目 ? [ ...

  2. 理解记忆三种常见字符编码:ASCII, Unicode,UTF-8

    理解什么是字符编码? 计算机只能处理数字,如果要处理文本,就必须先把文本转换为数字才能处理.最早的计算机在设计时采用8个比特(bit)作为一个字节(byte),所以,一个字节能表示的最大的整数就是25 ...

  3. ASP.NET获取客户端的相关信息

    /// <summary>        /// 获取远程浏览器端 IP 地址        /// </summary>        /// <returns> ...

  4. mingw32 捕获异常的4种方法

    ------------------------------------------------------------------------------- 1. 利用 windows 的API S ...

  5. stdlib.h stdio.h

    stdlib.h 即standard library标准库头文件.stdlib.h里面定义了五种类型.一些宏和通用工具函数. 类型例如size_t.wchar_t.div_t.ldiv_t和lldiv ...

  6. jquery图片轮播

    <html> <head> <title>position</title> <style type="text/css"> ...

  7. 关于kali2.0rolling中metasploit升级后无法启动问题的解决总结

    最近在学习metasploit的使用,文中提到可以使用msfupdate命令来对metasploit的payload.exploit等进行升级,我就试了一下,没想到升级过程并不麻烦,但升级后却出现了无 ...

  8. (2016弱校联盟十一专场10.3) B.Help the Princess!

    题目链接 宽搜一下就行. #include <iostream> #include<cstdio> #include<cstring> #include<qu ...

  9. mysql知识

    1.Limit 在语句的最后,起到限制条目的作用 Limit [offset,] [N] offset:偏移量 N:取出条目 例子:select * from stu limit 3,3; 2.左连接 ...

  10. hive数据操作

    mdl是数据操作类的语言,包括向数据表加载文件,写查询结果等操作 hive有四种导入数据的方式 >从本地加载数据 LOAD DATA LOCAL INPATH './examples/files ...