当前位置: 首页 > news >正文

网站界面设计的基本原则是什么网页设计作业成品免费下载

网站界面设计的基本原则是什么,网页设计作业成品免费下载,电商平台模板,沈阳城市建设学院官方网站在iOS的开发过程中#xff0c;tableView的使用永远都是最常用的控件。今天学习了一下tableViewCell的操作。代码并不是很复杂#xff0c;如果有OC开发经验的人#xff0c;应该很容易看懂的。 class ViewController: UIViewController ,UITableViewDelegate, UITableViewData…在iOS的开发过程中tableView的使用永远都是最常用的控件。今天学习了一下tableViewCell的操作。代码并不是很复杂如果有OC开发经验的人应该很容易看懂的。 class ViewController: UIViewController ,UITableViewDelegate, UITableViewDataSource { // 因为Swift中要求变量或常量在声明时就要初始化其值所以我们在实际开发中声明变量或常量时使用可选类型。后面代码中使用到以上变量时需要加 ! 对其解包。var tableView : UITableView? // var items :NSMutableArray?// 例如可以不用可选var items :NSMutableArray []var leftBtn:UIButton?override func viewDidLoad() {super.viewDidLoad()self.items NSMutableArray()// 初始化tableViewsetupViews()// 右边添加按钮setupRightBarButtonItem()// 左边删除按钮setupLeftBarButtonItem();}func setupViews(){self.tableView UITableView(frame:self.view!.frame)self.tableView!.delegate selfself.tableView!.dataSource selfself.tableView!.registerClass(UITableViewCell.self, forCellReuseIdentifier: cell)self.view.addSubview(self.tableView!)}func setupLeftBarButtonItem(){self.leftBtn UIButton(type: UIButtonType.Custom)self.leftBtn!.frame CGRectMake(0,0,50,40)self.leftBtn!.setTitleColor(UIColor.redColor(), forState: UIControlState.Normal)self.leftBtn!.setTitle(Edit, forState: UIControlState.Normal)self.leftBtn!.tag 100self.leftBtn!.userInteractionEnabled falseself.leftBtn!.addTarget(self, action: leftBarButtonItemClicked, forControlEvents: UIControlEvents.TouchUpInside)let barButtonItem UIBarButtonItem(customView: self.leftBtn!)self.navigationItem.leftBarButtonItem barButtonItem}func setupRightBarButtonItem(){let barButtonItem UIBarButtonItem(title: Add, style: UIBarButtonItemStyle.Plain, target: self, action: rightBarButtonItemClicked)self.navigationItem.rightBarButtonItem barButtonItem}func rightBarButtonItemClicked(){let row self.items.countlet indexPath NSIndexPath(forRow:row,inSection:0)self.items.addObject(1)self.tableView?.insertRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Left)self.leftBtn!.userInteractionEnabled true}func leftBarButtonItemClicked(){if (self.leftBtn!.tag 100){// 设置当前tableView可编辑self.tableView?.setEditing(true, animated: true)self.leftBtn!.tag 200self.leftBtn?.setTitle(Done, forState: UIControlState.Normal)}else{self.tableView?.setEditing(false, animated: true)self.leftBtn!.tag 100self.leftBtn?.setTitle(Edit, forState: UIControlState.Normal)}}override func didReceiveMemoryWarning() {super.didReceiveMemoryWarning()// Dispose of any resources that can be recreated.}func tableView(tableView: UITableView, numberOfRowsInSection section: Int) - Int{return self.items.count}func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) - UITableViewCell{let cell tableView .dequeueReusableCellWithIdentifier(cell, forIndexPath: indexPath) as UITableViewCellcell.textLabel!.text String(format: %i, indexPath.row1)return cell}// 指定可编辑的行func tableView(tableView: UITableView, setEditing indexPath: NSIndexPath) - Bool{return true}// 编辑完成func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath){self.items.removeObjectAtIndex(indexPath.row)self.tableView?.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Top)if (self.items.count 0){self.leftBtn!.userInteractionEnabled false}}// 编辑样式func tableView(tableView: UITableView, editingStyleForRowAtIndexPath indexPath: NSIndexPath) - UITableViewCellEditingStyle{return (UITableViewCellEditingStyle.Delete)}// 指定哪些行可以移动func tableView(tableView: UITableView, canMoveRowAtIndexPath indexPath: NSIndexPath) - Bool{return true}// 移动完成func tableView(tableView: UITableView, moveRowAtIndexPath sourceIndexPath: NSIndexPath, toIndexPath destinationIndexPath: NSIndexPath){self.tableView?.moveRowAtIndexPath(sourceIndexPath, toIndexPath: destinationIndexPath)self.items.exchangeObjectAtIndex(sourceIndexPath.row, withObjectAtIndex: destinationIndexPath.row)}// 限制在同一分区移动func tableView(tableView: UITableView, targetIndexPathForMoveFromRowAtIndexPath sourceIndexPath: NSIndexPath, toProposedIndexPath proposedDestinationIndexPath: NSIndexPath) - NSIndexPath {if sourceIndexPath.section proposedDestinationIndexPath.section {return proposedDestinationIndexPath}return sourceIndexPath}// 点击cellfunc tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath){print(row %d,indexPath.row)}}转载于:https://www.cnblogs.com/wangxianggudu/p/5107733.html
http://www.pierceye.com/news/540744/

相关文章:

  • 深圳住房和建设局官网网站设计导航精选最好的设计网站大全
  • 个人备案网站建设方案书网站开发实训教程
  • 周口网站关键词优化重庆招商网
  • 国内优秀网站设计师江西宜春市城市建设档案馆网站
  • 怎么查看网站用的php还是.networdpress博客页修改
  • 企业查询网站wordpress注册没反应
  • 如何建立自已的购物网站长沙网站制作主要公司
  • 深圳 电子政务网站建设方案WordPress的login在哪里改
  • 网站快速网站推广怎么制作图片视频和配音乐
  • 河南网站制作团队湖南网址大全
  • 2019为网站网站做代理被判缓刑网站信息化建设建议
  • 部署推进网站建设网站域名费用
  • 企业信息门户网站建设方案seo网站模版
  • 谷歌有做网站建设快速建站哪里好
  • 坤和建设 网站深圳高端网站设计开发
  • 怎么做网站策划的模板如何注册咨询公司
  • 做婚恋网站投入多少钱php注册网站源码带数据库
  • 苏州网站建设制作方案手机上做app的软件
  • 青岛营销型网站html网页制作期末作业
  • 加强网站微信公众号平台建设php 5.4 wordpress
  • 比价网站开发东莞微客巴巴做网站
  • 怎么免费搭建自己的网站交互网站建设
  • 网站架构 规划考研网站做刷词
  • 昆山网站建设kshuituo适合seo优化的站点
  • 免费十八种禁用网站圣诞网站怎么做
  • 做网站排名赚钱吗安卓开发快速入门
  • 南宁百度网站建设求个网站或者软件
  • 岳阳网站项目建设报道网站建设色调的
  • 站长平台怎么添加网站南京市高淳县建设厅网站
  • 广州市住房和城乡建设厅网站首页一键制作自己的app软件