iOS TableVew 侧滑效果~ Swift语言~demo
来源:互联网 发布:小说下载软件免费 编辑:程序博客网 时间:2024/06/03 21:11
//联系人:石虎 QQ: 1224614774昵称:嗡嘛呢叭咪哄
/**
注意点: 1.看 GIF 效果图.
2.看连线视图的效果图.
3.看实现代码(直接复制实现效果).
4.详细请看:http://www.jianshu.com/p/a7d8774eb1c8
*/
一、GIF 效果图:
二、连线视图的效果图:
图1:
图2:
图3:
三、实现代码:
=============
======================================
控制器1: class ViewController
//
// ViewController.swift
// TableVew 侧滑效果~ swift语言
//
// Created by 石虎 on 2017/8/21.
// Copyright © 2017年 shihu. All rights reserved.
//
import UIKit
class ViewController:UIViewController ,UITableViewDelegate,
UITableViewDataSource {
//创建全局的内容
var tableView =UITableView()
var array =NSArray()
overridefunc viewDidLoad() {
super.viewDidLoad()
tableView =UITableView(frame:self.view.bounds,
style: .plain)
//设置代理
tableView.delegate =self
tableView.dataSource =self
//行高
tableView.rowHeight =80
//添加到视图中
self.view.addSubview(tableView)
array = ["01","02","03","04","05","06",
"07","08","09","010","011"]
}
//协议必须遵守的方法
func tableView(_ tableView:UITableView,
numberOfRowsInSection section: Int) ->Int{
returnarray.count
}
func tableView(_ tableView:UITableView,
cellForRowAt indexPath: IndexPath) ->UITableViewCell{
//注册cell
let identifier ="identtifier";
var cell=tableView.dequeueReusableCell
(withIdentifier: identifier)
//缓存池
if(cell ==nil){
cell=UITableViewCell(style:UITableViewCellStyle.value1, reuseIdentifier: identifier);
}
cell?.textLabel?.text =array[indexPath.row]as?String;
cell?.backgroundColor = #colorLiteral(red: 0.7254902124, green: 0.4784313738, blue: 0.09803921729, alpha: 1)
cell?.textLabel?.textColor = #colorLiteral
(red: 1, green: 1, blue: 1, alpha: 1)
cell?.accessoryType = UITableViewCellAccessoryType.disclosureIndicator
return cell!
}
// 更多按钮设置
func tableView(_ tableView:UITableView, editActionsForRowAt indexPath:IndexPath) -> [UITableViewRowAction]?
{
//右侧第一个按钮
let actionOne =UITableViewRowAction
(style: .normal, title:"我是第一个") {_,_in
//提示框
let alert =UIAlertController
(title:"第一个点击成功
- iOS TableVew 侧滑效果~ Swift语言~demo
- iOS TableVew 侧滑效果~ OC语言~demo
- iOS侧滑效果Demo
- iOS 仿照网易侧栏效果demo
- ios FlowCover效果demo
- iOS Calendar Demo OC + Swift
- iOS UITextView(swift语言)
- ios 全景浏览效果demo
- ios 自制放大镜效果demo
- ios 全景浏览效果demo
- iOS侧拉栏抽屉效果Demo
- ios 动画效果实现demo
- iOS 侧滑菜单封装Demo(类似QQ侧滑效果)
- XCode下Swift – WebView IOS demo
- iOS swift 一个百度地图Demo
- iOS Swift语言的成长
- iOS开发系列--Swift语言
- iOS开发系列--Swift语言
- 随笔2
- Poj 1655(树的重心、树形DP、经典)
- tf.flags.DEFINE_string
- 谷歌插件Postman下载+安装
- C/C++ 开发总结 -- 【持续更新】
- iOS TableVew 侧滑效果~ Swift语言~demo
- Xdebug +Webgrind
- 程序员面试金典(6):像素翻转(python)
- jquery避免事件冒泡(屏蔽父节点事件)
- 设计模式之解释器模式,访问者模式
- mysql多列分区表,查询只使用第二个字段是否能自动分区裁剪测试
- 《华为机试在线训练》之合唱队
- 程序是如何执行的(二)控制结构的执行
- ProcessOn——一个狠不错的画文章组织结构和思维导图的工具