微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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)

原文地址:https://www.jb51.cc/swift/327243.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐