加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

swift学习笔记之QQ简写

发布时间:2020-12-14 02:14:05 所属栏目:百科 来源:网络整理
导读:Qq项目学习 键盘设置点击屏幕后返回 self . messageInputTextField . resignFirstResponder () 需要添加UITextfield的代理 tableview 注册cell tableViewMessInfo . registerClass ( UITableViewCell . self ,forCellReuseIdentifier: "cell" ) tableViewMes

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)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读