swift学习笔记之QQ简写

Qq项目学习

键盘设置点击屏幕后返回

self.messageInputTextField.resignFirstResponder()

需要添加UITextfield的代理

tableview

注册cell

tableViewMessInfo.registerClass(UITableViewCell.self,forCellReuseIdentifier: "cell")

tableViewMessInfo.dataSource = self

tableViewMessInfo.delegate = self

tableViewMessInfo.frame = CGRectMake(0,64,self.view.frame.width,self.view.frame.height - 94)

tableViewMessInfo.separatorColor = UIColor.clearColor() //设置背景颜色

tableViewMessInfo.backgroundColor = UIColor.clearColor()

self.view.addSubview(tableViewMessInfo)

cell.selectionStyle = .None

//设置cell的点击风格

点击UITextField被键盘遮住

func textFieldDidBeginEditing(textField: UITextField) {

println("开始输入")

var frame = self.view.frame

frame.origin.y = -260

self.view.frame = frame

} //界面上移动260像素

界面跳转

self.dismissViewControllerAnimated(true,completion: nil)

self.presentViewController(HomeViewController(),animated: true,completion: nil)

tableview重新加载数据

self.tableViewMessInfo.reloadData()

设置导航栏

var navigationItems = UINavigationItem()

var navigationBar = UINavigationBar()

navigationItems.leftBarButtonItem = UIBarButtonItem(title: "返回",style: .Plain,target: self,action: "cancle")

navigationItems.rightBarButtonItem = UIBarButtonItem(title: "关于联系人",action: "about")

navigationItems.title = "聊天"

navigationBar.tintColor = UIColor.blueColor()

navigationBar.frame = CGRectMake(0,0,64)

navigationBar.pushNavigationItem(navigationItems,animated: true)

self.view.addSubview(navigationBar)

相关文章

软件简介:蓝湖辅助工具,减少移动端开发中控件属性的复制和粘...
现实生活中,我们听到的声音都是时间连续的,我们称为这种信...
前言最近在B站上看到一个漂亮的仙女姐姐跳舞视频,循环看了亿...
【Android App】实战项目之仿抖音的短视频分享App(附源码和...
前言这一篇博客应该是我花时间最多的一次了,从2022年1月底至...
因为我既对接过session、cookie,也对接过JWT,今年因为工作...