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) ...
随机推荐
- 统计中的bitMap
//位图的概念就是在个一字节八位的地方存八个状态 比如 bool hash[] 表示某个数字被标记过,一个数字需要一个字节 而bitMap就是可以把每位都用来标记,起到节约空间的目的 //位图的概念就 ...
- 【python】函数名存在变量中
变量函数:意思就是将函数名存在变量中,然后根据变量值动态的调用需要的函数. LOGIN = 'xxxx' PASSWD = "xxx" URL = 'xxxxx' def hand ...
- ruby的代码风格
http://stylesror.github.io/ 大部分同意,有小部分,不敢苟同.
- emacs之配置2,UI基本设置
在-下建立目录emacsConfig,里面建立一些自己写的el脚本,下面是名字随便,我的 emacsConfig/ui-setting.el ;关闭Emacs的默认启动界面 (setq inhibit ...
- TCP heart
http://blog.csdn.net/lisonglisonglisong/article/details/51327695
- <转--大话session>
大话Session 原文地址:http://www.cnblogs.com/shoru/archive/2010/02/19/1669395.html 结语 到这里,读者应该对session有了更多的 ...
- Java 获取字符串指定下标位置的值 charAt()
Java手册 charAt public char charAt(int index) 返回指定索引处的 char 值.索引范围为从 0 到 length() - 1.序列的第一个 char 值位于索 ...
- 学习笔记之SQL / MySQL
SQL Fiddle(在线执行SQL语句的网站) http://www.sqlfiddle.com/ MySQL https://www.mysql.com/ MySQL :: MySQL 5.7 R ...
- C++中如何强制inline函数(MSVC, GCC)
#ifdef _MSC_VER_ // for MSVC #define forceinline __forceinline #elif defined __GNUC__ // for gcc on ...
- RMAN非归档
改变归档模式到非归档模式: 1)SQL>SHUTDOWN IMMEDIATE; 2)SQL>STARTUP MOUNT; 3)SQL>ALTER DATABASE NOARCHIVE ...