swift学习之UITabelView ----使用xib定义cell
// TwoViewController.swift
// tab
//
// Created by su on 15/12/7.
// Copyright © 2015年 tian. All rights reserved.
//
import UIKit
class TwoViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = UIColor.redColor()
self.navigationItem.title = "bb"
let tableView:UITableView = UITableView(frame: view.bounds, style: UITableViewStyle.Plain)
tableView.registerNib(UINib(nibName: "TwoTableViewCell", bundle: nil), forCellReuseIdentifier: "TwoTableViewCell")
tableView.delegate = self
tableView.dataSource = self
self.view.addSubview(tableView)
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 4
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("TwoTableViewCell", forIndexPath: indexPath) as! TwoTableViewCell
cell.label!.text = "adddddddddddddddddddddddddddddd"
return cell
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
swift学习之UITabelView ----使用xib定义cell的更多相关文章
- swift学习之UITabelView ----UITableViewCell
// // OneViewController.swift // tab // // Created by su on 15/12/7. // Copyright © 2015年 tian. ...
- [iOS]通过xib定义Cell然后关联UICollectionView
先新建一个View的xib,然后删掉自动生成的View,拖进一个UICollectionCell,再新建一个对应的UIView继承UICollectionCell类. OK,接下来该连outlet的就 ...
- iOS深入学习(UITableView系列4:使用xib自定义cell)
可以通过继承UITableViewCell重新自定义cell,可以像下面一样通过代码来自定义cell,但是手写代码总是很浪费时间, ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ...
- Swift学习——类的定义,使用,继承,构造等(五)
Swift学习--类的定义,使用.继承,构造等(五) 类的使用说明 1 使用class和类名来创建一个类名,比如: class student 2 类中属性的声明和常量和变量一样,唯一的差别就是他们的 ...
- iOS ---Swift学习与复习
swift中文网 http://www.swiftv.cn http://swifter.tips/ http://objccn.io/ http://www.swiftmi.com/code4swi ...
- 12套swift学习资源分享
虽然objective-c编程语言在过去很长一段时间都是iOS应用开发的基础语言,且很多iOS开发者对其也深爱有佳,但是随着swift编程语言的问世,迅速发展为开发者追捧的语言.且今年伴随着swift ...
- swift 学习之自动引用计数
swift 学习之自动引用计数 学习和研究的主要是"实例对象和实例对象直接的相会强引用所产生的内从泄漏"和"使用闭包产生的强引用造成的内存泄漏" 注意:只有以引 ...
- Swift学习目录
本学习基于苹果官方Swift学习材料,保留了原版90%左右的内容(一些项目开发中基本不用的知识点没有整理),并根据理解进行整理.如对原版感兴趣,可以直接单击链接阅读和学习. 第一部分 基础篇 1.基本 ...
- Swift学习笔记(十四)——字符,常量字符串与变量字符串
在学习Java过程中,字符串碰到过String和StringBuffer,当中前者是不可变的,不能对字符串进行改动:后者是可变的,能够不断改动. 来到Swift中,对字符串的定义变的更加简单. (1) ...
随机推荐
- IE9 下面, XMLHttpRequest 是不支持跨域请求的解决方法
在 IE9 下面, XMLHttpRequest 是不支持跨域请求的. IE10 的 XMLHttpRequest 支持跨域, 而 IE8, IE9 需要使用 XDomainRequest 来实现跨域 ...
- postman 获取时间戳的方法 和md5加密的方法
获取时间戳方法: postman.setGlobalVariable("timestamp",Math.round(new Date().getTime())); 这整句是获取 ...
- E: Invalid operation build-depgcc(给字符界面的ubuntu安装gcc 报错
sudo apt-get build-depgccE: Invalid operation build-depgcc 原因是中间少了个空格, 使用如下命令即可. sudo apt-get buil ...
- Oracle VM Virtualbox基础知识
修改硬盘的UUID VBoxManage internalcommands sethduuid <filename>
- win和linux下控制台界面中停顿X秒的方式
win localhost > nul linux
- Ansible Jinja if 生成不同的MySQL文件
- Xpath解析xml
Xpath解析xml其实最主要的是查找xml文档中信息,而且不需要了解xml文档结构 package com.huawei.xml; import java.io.InputStream;import ...
- Redis OBJECT命令
[Redis OBJECT命令] 1.OBJECT subcommand [arguments [arguments]] OBJECT 命令允许从内部察看给定 key 的 Redis 对象. 它通常用 ...
- Shder中实现TintColor
[Shder中实现TintColor] TintColor实现上相当于一个滤镜,若TintColor的R为0,则原图的R通道颜色应该为0.基于此,实现TintColor很容易,原图颜色直接乘以Tint ...
- web和wap网站的区别 (转)
WAP的全称是“无线应用协议(Wireless Application Protocol)”,是一种向移动终端提供互联网内容和先进增值服务的全球统一的开放式协议标准, 是简化了的无线Internet ...