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. UVa2326

    理解:区域覆盖.注意1,属于的区间有大小颠倒的情况:注意2,看图 ,两排房间公用一条走廊(for instance 1->3  4->6 不可公用) #include<iostrea ...

  2. Codeforces 696 C. PLEASE

    Description 三个杯子,一开始钥匙在中间,每次等概率的选择两边的两个,与中间的交换,问第 \(n\) 次选择中间的杯子是钥匙的概率是多少. \(n=\sum_{i=1}^{k} a_i,a_ ...

  3. FreeImage编译及遇到问题解决

    FreeImage编译及遇到问题解决 1.下载freeImage源码包 wget http://downloads.sourceforge.net/freeimage/FreeImage3170.zi ...

  4. PHP setcookie() 函数

    语法 setcookie(name,value,expire,path,domain,secure): name 必需.规定 cookie 的名称. value 必需.规定 cookie 的值. ex ...

  5. SQL/T-SQL实例参考

    ,D.[Score] B_Score ,'Distince'= CASE WHEN C.Score > D.Score THEN C.[Score] - D.[Score] WHEN C.Sco ...

  6. 【Maven】解决缺少Jar包问题

    解决办法:进入项目的根目录(即 pom.xml文件所在的目录)执行:mvn dependency:copy-dependencies完成后进入eclipse,发现项目不再报错前提条件:1,安装了mav ...

  7. monkeyrunner API接口文档内容

    用python编写脚本   1.导入模块: MonkeyRunner MonkeyDevice MonkeyImage ps:如果给导入模块起别名,就应该使用别名,而不能使用原名,否则会出现错误. f ...

  8. Intent之复杂数据的传递

    想在两个Activity之间传递一个对象Result,在网上差了很多,都需要序列化或者时下Paracelable,等等,试了很多都不行. 后来才制单,这个Result,根本不需要集成Sereriabl ...

  9. NIO初识

    Java编程中的NIO,俗称new I/O,是在JDK1.4版本之后开始引入的,在JDK1.4之前,Java服务端大多使用同步阻塞式来处理网络请求,在低流量.低并发情况还能抗住,在如今互联网时代,信息 ...

  10. Arch Linux中文乱码解决

    Arch Linux中文乱码解决 1.安装中文字体 pacman -S wqy-zenhei ttf-fireflysung (flash乱码)   ---乱码的原因就是缺少中文字体的支持,下载文泉驿 ...