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. T-SQL 语句的优化

    SQL调优. 1.索引是数据库调优的最根本的优化方法.聚簇索引.非聚簇索引. 聚簇索引:物理序与索引顺序相同.(只能有一个) 非聚簇索引:物理顺序与索引顺序不相同. 2.调整WHERE 子句中的连接顺 ...

  2. mediastreamer使用教程

    mediastreamer使用教程 1.各个函数功能简介 ms_filter_destroy 释放filter资源 ms_ticker_destroy释放ticker 说明:ticker为定时器线程, ...

  3. js 的复制和引用 (传值和传址)

    复制(传值-实参):  基本类型赋值.函数参数 引用(传址-形参):  对象.数组.函数

  4. 自定义el函数

    1.1.1 自定义EL函数(EL调用Java的函数) 第一步:创建一个Java类.方法必须是静态方法. public static String sayHello(String name){ retu ...

  5. java utils

    1.获取resouces中文件的绝对路径 String filePath = XXX.class.getClassLoader().getResource("/configs/interfa ...

  6. asp.net mvc 多级文件夹

    ASP.NET MVC - 定制属于你自己的ViewEngine 标签: asp.netmvcstring引擎razorapplication 2012-07-26 14:17 5365人阅读 评论( ...

  7. .NET 获取类型中的属性

    解决方案      通过反射的方式获取类型中的所有属性. 引用命名空间 using System.Reflection; 实体类 public class User { private string ...

  8. Delphi 控件大全

    delphi 控件大全(确实很全)   delphi 控件查询:http://www.torry.net/ http://www.jrsoftware.org Tb97 最有名的工具条(ToolBar ...

  9. python之常用内置函数

    python内置函数,可以通过python的帮助文档 Build-in Functions,在终端交互下可以通过命令查看 >>> dir("__builtins__&quo ...

  10. 配置使用EF常见的一些问题及解决方案

    转自http://www.2cto.com/database/201511/449573.html 提示未注册,找不到驱动程序 No Entity Framework provider found f ...