iOS TableVew 侧滑效果~ OC语言~demo
来源:互联网 发布:照片尺寸修改软件 编辑:程序博客网 时间:2024/06/15 21:42
//联系人:石虎 QQ: 1224614774昵称:嗡嘛呢叭咪哄
/**
注意点: 1.看 GIF 效果图.
2.看连线视图的效果图.
3.看实现代码(直接复制实现效果).
*/
一、GIF 效果图:
二、连线视图的效果图:
图1:
三、实现代码:
=============
======================================
控制器1: ViewController.m
//
// ViewController.m
// TableVew 侧滑效果~ OC语言
//
// Created by 石虎 on 2017/8/21.
// Copyright © 2017年 shihu. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong)UITableView *tableView;
@end
@implementation ViewController
- (void)viewDidLoad {
[superviewDidLoad];
_tableView = [[UITableViewalloc]initWithFrame:CGRectMake(0,60,self.view.frame.size.width , self.view.frame.size.height)];
_tableView.backgroundColor = [UIColororangeColor];
_tableView.delegate =self;
_tableView.dataSource =self;
_tableView.rowHeight =80;
[self.tableViewregisterClass:[UITableViewCellclass]forCellReuseIdentifier:@"CELL"];
[self.viewaddSubview:_tableView];
}
#pragma mark -- 数据源方法
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return10;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
// cell 的唯一标识符
staticNSString *ider =@"CELL";
//创建 cell
UITableViewCell *cell = [tableViewdequeueReusableCellWithIdentifier:iderforIndexPath:indexPath];
//缓存池
if (!cell) {
cell = [[UITableViewCellalloc]initWithStyle:UITableViewCellStyleDefaultreuseIdentifier:ider];
}
//赋值内容
cell.textLabel.text = [NSStringstringWithFormat:@"row --- %ld",(long)indexPath.row];
//cell 的背景颜色
cell.backgroundColor = [UIColoryellowColor];
return cell;
}
#pragma mark -- 代理方法
//这个方法就是可以自己添加一些侧滑出来的按钮,并执行一些命令和按钮设置
- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(nonnullNSIndexPath *)indexPath
{
//设置按钮(它默认第一个是修改系统的)
UITableViewRowAction *actionOne = [UITableViewRowActionrowActionWithStyle:UITableViewRowActionStyleNormaltitle:@"我是第一个"handler:^(UITableViewRowAction *_Nonnull action,NSIndexPath *_Nonnull indexPath) {
NSLog(@"我是第一个----->");
[[[UIAlertViewalloc]initWithTitle:@"提醒"message:@"我是第一个点击成功"delegate:nilcancelButtonTitle:@"确定"otherButtonTitles:nil]
show];
}];
//设置按钮(它默认第一个是修改系统的)
UITableViewRowAction *actionTwo = [UITableViewRowActionrowActionWithStyle:UITableViewRowActionStyleDefaulttitle:@"我是第二个"handler:^(UITableViewRowAction *_Nonnull action,NSIndexPath *_Nonnull indexPath) {
//执行跳转到下个界面操作
NSLog(@"我是第二个----->");
[[[UIAlertViewalloc]initWithTitle:@"提醒"message:@"我是第二个点击成功"delegate:nilcancelButtonTitle:@"确定"otherButtonTitles:nil]
show];
}];
actionOne.backgroundColor = [UIColorblueColor];
actionTwo.backgroundColor = [UIColorredColor];
return@[actionOne,actionTwo];
}
@end
===============
=======
- iOS TableVew 侧滑效果~ OC语言~demo
- iOS TableVew 侧滑效果~ Swift语言~demo
- iOS侧滑效果Demo
- IOS 霓虹灯效果(oc)
- iOS 仿照网易侧栏效果demo
- ios FlowCover效果demo
- iOS Calendar Demo OC + Swift
- iOS 通讯录(OC 语言)
- ios 全景浏览效果demo
- ios 自制放大镜效果demo
- ios 全景浏览效果demo
- iOS侧拉栏抽屉效果Demo
- ios 动画效果实现demo
- iOS 侧滑菜单封装Demo(类似QQ侧滑效果)
- iOS之OC随笔-类别(分类)Demo
- iOS开发--OC篇--OC语言简介
- iOS OC语言(二) 类
- iOS OC语言(三) 继承
- ccf认证最优灌溉
- ajax上传form表单数据
- 设计模式-适配器模式
- 一个 Linux 上分析死锁的简单方法
- spring boot 读取配置文件问题,不能使用@Autowired
- iOS TableVew 侧滑效果~ OC语言~demo
- c#类
- 反射第五步 : 通过反射获取某一个类的字段值,并设置字段值 (很少用)
- 如何将BufferedImage转换成字节数组?
- 普通用户授予root权限
- linux上传文件 rz命令 提示command not found 解决方法
- Swift
- qt压缩文件
- HTTPS那些事 用java实现HTTPS工作原理