swift学习之UITabelView ----UITableViewCell
// OneViewController.swift
// tab
//
// Created by su on 15/12/7.
// Copyright © 2015年 tian. All rights reserved.
//
import UIKit
let ID = "cell"
class OneViewController: UIViewController,UITableViewDelegate, UITableViewDataSource {
// let myTabelView:UITableView!
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = UIColor.blueColor()
self.navigationItem.title = "aa"
//创建tableview
let tabelView = UITableView(frame: view.bounds, style: UITableViewStyle.Plain)
//注册cell
tabelView.registerClass(UITableViewCell.self, forCellReuseIdentifier: ID)
//下边这种方法也是可以的
// tabelView.registerClass(UITableViewCell.classForCoder(), forCellReuseIdentifier: ID)
//设置代理和数据源
tabelView.delegate = self
tabelView.dataSource = self
tabelView.tableFooterView = UIView()
//加到view上
self.view.addSubview(tabelView)
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 10
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier(ID, forIndexPath: indexPath)
cell.textLabel!.text = "假数据"
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 ----UITableViewCell的更多相关文章
- swift学习之UITabelView ----使用xib定义cell
// // TwoViewController.swift // tab // // Created by su on 15/12/7. // Copyright © 2015年 tian. ...
- 【swift学习笔记】二.页面转跳数据回传
上一篇我们介绍了页面转跳:[swift学习笔记]一.页面转跳的条件判断和传值 这一篇说一下如何把数据回传回父页面,如下图所示,这个例子很简单,只是把传过去的数据加上了"回传"两个字 ...
- 今天开始Swift学习
今天开始Swift学习 在此记录笔记 以备之后查阅! allenhuang
- 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学习之常用UI的使用
Swift学习之常用UI的使用 最近笔者在开始学习苹果最新的编程语言,因为笔者认为,苹果既然出了这门语言就绝对不会放弃,除非苹果倒闭了(当然这里知识一个玩笑). 所以在不久的将来,swift绝对是iO ...
- [转]swift 学习资源 大集合
今天看到了一个swift的学习网站,里面收集了很多学习资源 [转自http://blog.csdn.net/sqc3375177/article/details/29206779] Swift 介绍 ...
- swift 学习资源 大集合
今天看到一个swift学习网站,其中我们收集了大量的学习资源 Swift 介绍 Swift 介绍 来自 Apple 官方 Swift 简单介绍 (@peng_gong) 一篇不错的中文简单介绍 [译] ...
- Swift学习笔记(一)搭配环境以及代码运行成功
原文:Swift学习笔记(一)搭配环境以及代码运行成功 1.Swift是啥? 百度去!度娘告诉你它是苹果最新推出的编程语言,比c,c++,objc要高效简单.能够开发ios,mac相关的app哦!是苹 ...
随机推荐
- 在linux,arm上的屏幕搜索wifi并连接(qt,多选择,wifi按信号排列)转
先上代码!! #include "widget.h"#include "ui_widget.h"#include <QVBoxLayout>#inc ...
- JSP动作指令
JSP动作指令 动作指令与编译指令不间,编译指令是通知 Servlet 引擎的处理消息,而动作指令只是运行时的脚本动作.编译指令在将JSP 编译成 Servlet 时起作用:处理指令通常可替换成 Ja ...
- [java] java 实现FTP服务器文件的上传和下载
利用Apache commons-net 实现: package com.xwolf.driver.util; import com.xwolf.driver.exception.RunExcepti ...
- Mysql root 用户密码忘记后重置root密码
[windows] 1.停止mysql服务:打开命令行窗口CMD,Net stop mysql 2.用另外一种方式启动Mysql:在命令行进入到mysql的安装路径下的bin目录下使用 mysqld- ...
- 关于android 动态设置view 样式 问题(默认style)
解决方案一: Button btn=new Button(new ContextThemeWrapper(mContext,R.style.service_text_dialog_style),nul ...
- 32位汇编基础_cpu 寄存器
32位通用寄存器 EAX EBX ECX EDX EBP ESP ESI EDI 八个寄存器都可以作为普通的数据寄存器使用.但有的有特殊的用途: EAX 为累加器, ECX 为计数器, E ...
- python报头解决粘包简单实现
client------------- #!/usr/bin/env python # encoding: utf-8 # Date: 2018/6/5 import socketimport st ...
- HyberLedger Fabric学习(4)-chaincode学习(操作人员)
参考:http://hyperledger-fabric.readthedocs.io/en/latest/chaincode4noah.html chaincode也能被称作“智能合约”,一般情况下 ...
- ubantu的下载和在虚拟机VM中的安装
一.下载Ubuntu镜像文件 下载地址:http://www.ubuntu.com 打开上面的连接,我们来到如下页面,点击download: 下一步,到如下页面,点击Ubuntu Desktop: 然 ...
- strongswan
StrongSwan is an open source IPsec-based VPN Solution. It supports both the IKEv1 and IKEv2 key exch ...