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)