//
//  CustomTableViewCell.swift
//  tab
//
//  Created by su on 15/12/7.
//  Copyright © 2015年 tian. All rights reserved.
//

import UIKit

class CustomTableViewCell: UITableViewCell {
    var nameLabe: UILabel!
    var typeLabel: UILabel!
   
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.seupUI()
    }

required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
   
    func seupUI() {
        nameLabe = UILabel(frame: CGRect(x: 10, y: 10, width: 20, height: 20))
        nameLabe.backgroundColor = Tools().RGB(r: 122, g: 111, b: 123)
        self.addSubview(nameLabe)
        typeLabel = UILabel(frame: CGRect(x: 10, y: 40, width: 20, height: 20))
        typeLabel.backgroundColor = UIColor.blackColor()
        self.addSubview(typeLabel)
    }
   
//    func initWith(restName: String, restLocation: String){
//        nameLabe.text = restName
//        typeLabel.text = restLocation
//     
//    }
   
    override func awakeFromNib() {
        super.awakeFromNib()
       
        // Initialization code
    }
//   override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
//        super.init(style: UITableViewCellStyle, reuseIdentifier: String?)
//    }
   
    override func setSelected(selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

// Configure the view for the selected state
    }

}
 

//

//  ThreeViewController.swift

//  tab

//

//  Created by su on 15/12/7.

//  Copyright © 2015年 tian. All rights reserved.

//

import UIKit

class ThreeViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {

var tableView = UITableView()

override func viewDidLoad() {

super.viewDidLoad()

self.view.backgroundColor =  UIColor.grayColor()

self.navigationItem.title = "cc"

let right = UIBarButtonItem(title: "alertView", style: UIBarButtonItemStyle.Plain, target: self, action: "go:")

self.navigationItem.rightBarButtonItem = right

tableView = UITableView(frame: self.view.bounds)

tableView.delegate = self

tableView.dataSource = self

tableView.registerClass(CustomTableViewCell.self, forCellReuseIdentifier: "cell")

self.view.addSubview(tableView)

}

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

return 5

}

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

let identifier = "cell"

var cell = tableView.dequeueReusableCellWithIdentifier(identifier, forIndexPath: indexPath) as? CustomTableViewCell

if cell == nil {

cell = CustomTableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: identifier)

}

cell?.nameLabe.text = "123434555677yhgfcdxs"

cell?.typeLabel.text = "gggggggggggggggggggg"

return cell!

}

func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {

return 80

}

func go(right:UIBarButtonItem){

let pushVC = PushViewController()

self.navigationController?.pushViewController(pushVC, animated: true)

}

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.

}

*/

}

最新文章

  1. SQL Server 2012故障转移的looksalive check和is alive check
  2. mapreduce性能提升2
  3. PHP中使用redis执行lua脚本示例
  4. Extjs4.1中图片数据源
  5. xargs的- n1参数
  6. apache SetEnv 设置
  7. bochs 2.6安装和使用
  8. ASP.NET中的C#基础知识
  9. 【Python@Thread】thread模块
  10. Fiddler捕获localhost的网站
  11. IdentityServer4实战 - 基于角色的权限控制及Claim详解
  12. 第五次C语言作业
  13. 内存或磁盘空间不足 Microsoft Excel无法再次打开解决方法
  14. DOM+position:relative+缓冲运动
  15. Java 中转换为String类型的四种方法
  16. svn更新的时候出现ERROR:Previous operation has not finished,run "clean up" if it wa interrupted;进行clean up命令也报错
  17. [Ubuntu] 14.04 外接显示器分辨率调整
  18. 一个很棒的Flutter学习资源列表
  19. 剑指offer二十九之最小的K个数
  20. 问题 1476: [蓝桥杯][基础练习VIP]龟兔赛跑预测 (模拟)

热门文章

  1. 爬取爱奇艺电视剧url
  2. WinForm 每用户只允许创建一个实例
  3. linux 内核调试之关键函数名记要
  4. scrollWidth,clientWidth,offsetWidth的区别 ---转载的
  5. linux命令killall 、kill 、pkill 命令详解
  6. pythonNet day07
  7. Hive常见问题汇总
  8. django-url命名空间+反查
  9. Basic64 编码解码
  10. (网页的缓存控制)HTML配置no-cache(备忘) “Cache-control”常见的取值