swift-UITableView
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的更多相关文章
- Swift - UITableView展开缩放动画
Swift - UITableView展开缩放动画 效果 源码 https://github.com/YouXianMing/Swift-Animations // // HeaderViewTapA ...
- Swift - UITableView状态切换效果
Swift - UITableView状态切换效果 效果 源码 https://github.com/YouXianMing/Swift-Animations // // TableViewTapAn ...
- IOS SWIFT UITableView 实现简单微博列表
// // Weibo.swift // UITableViewCellExample // // Created by XUYAN on 15/8/15. // Copyright (c) 2015 ...
- Swift - UITableView里的cell底部分割线左侧靠边
override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, ...
- SWIFT UITableView的基本用法
import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: ...
- Swift - UITableView的用法
因为倾向于纯代码编码,所以不太喜欢可视化编程,不过也略有研究,所以项目里面的所有界面效果,全部都是纯代码编写! 终于到了重中之重的tableview的学习了,自我学习ios编程以来,工作中用得最多的就 ...
- Swift UITableView嵌套UICollectionView点击事件冲突(点击事件穿透)
不管是啥都响应tableviewcell class JYShopCertificationCell: UITableViewCell { override func hitTest(_ point: ...
- iOS Swift 模块练习/swift基础学习
SWIFT项目练习 SWIFT项目练习2 iOS Swift基础知识代码 推荐:Swift学习使用知识代码软件 0.swift中的宏定义(使用方法代替宏) 一.视图 +控件 1.UIImag ...
- IOS ViewTable
// // ViewController.swift // UITableView // // Created by lanou on 16/11/7. // Copyright (c) 20 ...
- iOS播放器、Flutter高仿书旗小说、卡片动画、二维码扫码、菜单弹窗效果等源码
iOS精选源码 全网最详细购物车强势来袭 一款优雅易用的微型菜单弹窗(类似QQ和微信右上角弹窗) swift, UITableView的动态拖动重排CCPCellDragger 高仿书旗小说 Flut ...
随机推荐
- 记录一下两个比较常用的md5加密算法
第一个,计算字符串的md5值 public static String getMD5(String s){ String newString = null; byte[] inputByteArray ...
- ubuntu15.10安装搜狗拼音输入法
sudo vim /etc/apt/sources.list.d/ubuntukylin.list(我的默认显示没有这个文件将自动创建) 添加源deb http://archive.ubuntukyl ...
- Spring基础知识
Spring基础知识 利用spring完成松耦合 接口 public interface IOutputGenerator { public void generateOutput(); } 实现类 ...
- windows7 安装PHP7 本地网站搭建
2016年5月21日 18:21:12 星期六 PHP7用了vc14编译的, 因此windows要下载安装一个vc14的发行包, 只有16M 2016年6月1日 23:23:52 星期三 利用PHP自 ...
- 【python】isinstance可以接收多个类型,hasattr,getattr,setattr
来源:廖雪峰 可以判断一个变量是否是某些类型中的一种,比如下面的代码就可以判断是否是str或者unicode: >>> isinstance('a', (str, unicode)) ...
- 【XLL 框架库函数】 TempMissing/TempMissing12
创建一个xltypeMissing 类型的 XLOPER/XLOPER12 原型 LPXLOPER TempMissing(void); LPXLOPER12 TempMissing12(void); ...
- 配置https
引子: 最近在一篇文章中了解到EFF(电子前哨基金会)为了推广https协议,成立了一个let'sencrypt项目,可以发放免费的证书,此证书可以被大多数主流浏览器所信任,这个邪恶的念头一爆发,就让 ...
- rename
重命名文件名: # rename hosts.conf.正式配值文件 hosts.conf.正式配置文件 hosts.conf.正式配值文件 [root@monitor- vhost]# ls hos ...
- Pyqt 动态的添加控件
Pyqt 动态的添加控件 # -*- coding: utf-8 -*- from PyQt4.QtCore import * from PyQt4.QtGui import * import sys ...
- Maven搭建 Spring环境
http://www.cnblogs.com/huaizuo/p/4920308.html http://mvnrepository.com/artifact/commons-logging/comm ...