UITableView编辑单元格多个按钮(4)

iOS 简单自定义UITableView左滑编辑按钮样式适配13 // 自定义左滑显示编辑按钮 -(NSArray<UITableViewRowAction*>*)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewRowAction *rowAction = [UITableViewRow... 阅读详情

ios 新的属性

typedef NS_ENUM(NSInteger, UITableViewRowActionStyle) {

    UITableViewRowActionStyleDefault =0,

    UITableViewRowActionStyleDestructive =UITableViewRowActionStyleDefault,

    UITableViewRowActionStyleNormal

} NS_ENUM_AVAILABLE_IOS(8_0);


NS_CLASS_AVAILABLE_IOS(8_0)@interface UITableViewRowAction : NSObject <NSCopying>


+ (instancetype)rowActionWithStyle:(UITableViewRowActionStyle)style title:(NSString *)title handler:(void (^)(UITableViewRowAction *action, NSIndexPath *indexPath))handler;

/////////////////下面实现相关代码////////////////////////////

(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath{

    

    returnYES;

}


- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath


{

    

    return UITableViewCellEditingStyleDelete;

    

}


-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{

    

    if (editingStyle ==UITableViewCellEditingStyleDelete) {

        

        [self.dataSourceremoveObjectAtIndex:indexPath.row];

        [self.tableViewdeleteRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationAutomatic];

    }

}

- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath{

    

    //设置删除按钮

      UITableViewRowAction *deleteRowAction = [UITableViewRowActionrowActionWithStyle:UITableViewRowActionStyleDestructivetitle:@"删除"handler:^(UITableViewRowAction *action,NSIndexPath *indexPath) {

          

          [self.dataSourceremoveObjectAtIndex:indexPath.row];

          [self.tableViewdeleteRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationAutomatic];

          

      }];

    

    //设置收藏按钮

    UITableViewRowAction *collectRowAction = [UITableViewRowActionrowActionWithStyle:UITableViewRowActionStyleDefaulttitle:@"收藏"handler:^(UITableViewRowAction *action,NSIndexPath *indexPath) {

        

      

        collectRowAction.backgroundColor = [UIColorgreenColor];

 

        UIAlertView *alertView = [[UIAlertViewalloc]initWithTitle:@"收藏"message:@"收藏成功"delegate:selfcancelButtonTitle:@"确定"otherButtonTitles:nil,nil];

        [alertView show];

        

        

    }];

    //设置置顶按钮

    UITableViewRowAction *topRowAction = [UITableViewRowActionrowActionWithStyle:UITableViewRowActionStyleDefaulttitle:@"置顶"handler:^(UITableViewRowAction *action,NSIndexPath *indexPath) {


        

        [self.dataSourceexchangeObjectAtIndex:indexPath.rowwithObjectAtIndex:0];

        

        NSIndexPath *firstIndexPath = [NSIndexPathindexPathForRow:0inSection:indexPath.section];

        [tableView moveRowAtIndexPath:indexPathtoIndexPath:firstIndexPath];

        

    }];

    

    collectRowAction.backgroundEffect = [UIBlurEffecteffectWithStyle:UIBlurEffectStyleLight];

    topRowAction.backgroundColor = [UIColorblueColor];

    collectRowAction.backgroundColor = [UIColorgrayColor];

    

    return  @[deleteRowAction,collectRowAction,topRowAction];

}

【精】表格(UITableView)总结(4):编辑(增加、删除、移动) 编辑:增加、删除、移动 阅读详情

相关推荐

UITableView:隐藏删除按钮和设置删除按钮的标题

UITableView:隐藏删除按钮和设置删除按钮的标题对应的Demo。

ios tableview上按钮点击删除cell

ios uitableview删除指定cell

bangtanhui的博客 927

iOS自定义button抖动效果并实现右上角删除按钮

主要介绍了iOS自定义button抖动效果并实现右上角删除按钮的相关资料,需要的朋友可以参考下

ios 编辑UITableView (添加数据 删除数据)

1 实现uitablview 代理方法 2 commitEditingStyle 实现后 可初步右滑删除 及添加删除代码 - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *...

a136447572的专栏 1638

qmt量化交易策略小白学习笔记第67期【qmt编程之获取ETF申赎清单】

qmt编程之获取ETF申赎清单

fanglue3705的博客 1773

深入探讨 VQ-VAE:理解变分量化自动编码器

VQ-VAE代表"Variational Quantized Variational Autoencoder",是一种生成模型,通常用于处理高维数据,如图像和音频。它的设计灵感来自于变分自动编码器(VAE)和量化方法,结合了它们的优点,使得 VQ-VAE 能够生成高质量的数据,并在数据表示上引入离散性。VQ-VAE 是一种强大的生成模型,结合了变分自动编码器和量化方法的优点。它在图像和音频生成、数据压缩和生成性对抗网络等领域具有广泛的应用。

DeepViewInsight的博客 7015

tableView cell 删除置顶

ios 新的属性 typedef NS_ENUM(NSInteger, UITableViewRowActionStyle) {     UITableViewRowActionStyleDefault =0,     UITableViewRowActionStyleDestructive =UITableViewRowActionStyleDefault,     UI

sunxiaoqqiao的博客 260

Arthas实战(3)- CPU使用率高问题排查

Arthas实战(3)- CPU使用率高问题排查

java_liuyuan的博客 1731

iOS tableviewcell左划自定义(带图片)删除按钮,点击任意地方取消删除的巧妙实现方法

转载请注明本文出自surfaceeee的博客(http://blog.youkuaiyun.com/u010519146/article/details/42882635),请尊重他人的辛勤劳动成果,谢谢! 本人一枚新入行的iOS程序猿,苦于tableviewcell左划删除按钮自定义(需要自定义图片)的方法,网上寻找多日未果,遂闭关两日,琢磨得此方法,第一次写博客,各位看官轻拍!废话少说,直入正题。 实现效果如图:     注意:此种方法适用于单个按钮功能自定义,但不适用于左划出现多个按钮的自定义(其实是我在赶

u010519146的专栏 1万+

光学设计进阶:Zemax中的坐标断点与离轴系统优化

本文深入解析了Zemax中坐标断点的核心原理与实战应用,它是实现离轴光学系统设计的关键。文章通过比喻和实例,详细阐述了如何利用坐标断点作为“方向盘”来精确控制光学元件的偏心和倾斜,实现“前断后接”的局部坐标系变换,从而构建并优化无中心遮拦的离轴反射系统,避免光线失控。

3a9bq4r8t2y的博客 525

剑灵解包器修改xml.dat文件修改乳量方法

本篇内容是基于单机版网游改单机版游戏剑灵的内容,主要针对关于单机版进行数据修改,当然了对于网端有关于剑灵已有很多,像小助手等多种可以更改,但是存在有封号危险,好,下面我们是在单机版中来进行乳量的修改教程。

灵魂学者的博客 3293

UITableView 自带编辑删除 自定义按钮

一:UITableView 自带编辑删除 1:实现两个方法即可 #pragma mark   tableView自带的编辑功能 -(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(N

小乔的博客 1849

基于PTB-XL数据集的深度学习心电信号分类

心电信号的分析与处理是心血管疾病诊断的重要手段。该领域的主要工作领域是分类,它越来越多地得到基于机器学习的算法的支持。在这项工作中,开发了一个深度神经网络来自动分类初级心电信号。这项研究是在PTB-XL数据库中包含的数据上进行的。提出了三种神经网络架构:第一种基于卷积网络,第二种基于SincNet,第三种基于卷积网络,

weixin_55121617的博客 7007

UITableView编辑模式

一、UITableView的编辑模式可以使UITableViewCell上出现添加按钮和删除按钮,通过代理方法进行对点击事件进行监听处理逻辑        1.通过代理方法设置对应UITableViewCell的编辑模式类型 -(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRow

u014656271的专栏 975

高频功率放大器的设计实现

摘 要 随着无线通信技术的高速发展,市场对射频电路的需求越来越大,同时对射频电路的性能要求也越来越高。高频功率放大器是位于无线发射级末端的重要部件,为了弥补信号在无线传输过程中的衰耗,要求发射机具有较大功率的输出,通信距离越远,要求的输出功率越大。在高频范围内,为了获得足够大的高频输出功率,就要采用高频功率放大器。 本次课程设计的高频功率放大器的技术指标包括输出功率、效率、功率增益、由于高频频功率放大器的输出功率比较大,耗能比较多,所以工作效率就显得比较重要。本课程设计的高频功率放大器电路由两极功率放大器

qq_43543515的博客 3万+

黑猫带你学eMMC协议第2篇:eMMC部分相关名词释义

1 前言 1.1 声明 本文依据eMMC JEDEC5.1、网络资料及个人工作经验整理而成,如有错误请留言。 本文结合eMMC JEDEC5.1协议手册查看效果更佳。 1.2 本文背景 本文关键词不包括emmc jedec5.1协议第3章节:《Terms and definitions》内容。关于emmc协议层的关键词,直接查阅spec相关章节即可,清晰明了,此处没必要再列出。 本文为本人工作学习中常听到或常用到关乎于emmc/flash的一些关键词合集,没有固定分类,不需要强行记忆,供查询使用。 1.

黑猫奥利奥的博客 7432

UITableView编辑

在上一篇关于UItableView的方法属性的一些应用,

IOSPanPan__的专栏 1090

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

UItableView编辑的使用edit, UItableView的一些常用方法

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {     self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];     if (self) {         // Custom i

lyj861144636的专栏 674

SIMATIC S7-1200, S7-1500 PID 控制[手册]

SIMATIC S7-1200, S7-1500 PID 控制[手册]

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

UITableView的删除,移动及修改删除按钮上的文字

其实修改UITableView进行删除操作的时候右边出现的删除按钮上的文字很简单: 重写delegate方法:-(NSString*)tableView:(UITableView*)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath*)indexpath; 如果需要出现UITableView上

dick_china的专栏 1万+

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

单元格左侧附带选择按钮

这是之前足球兄弟项目里实现的一个效果,联系人左侧有一个附带的选择按钮,点击可选中,再次点击取消选中。很简单的一个效果,由于当时工作经验不做,第一想法是在单元格的左侧添加按钮,设置按钮在选中和未选中状态的图片。后来发现一个非常简单的系统自带的方法,记录如下: 创建一个单元格 设置单元格为可编辑 创建tableView: UITableView *tableView = [[UITable

IOS_ZhuJianan的博客 2446

UITableView(修改单元格)

1.删除和插入单元格   表格一旦进入删除或插入状态,单元格的左边就会出现一个“编辑控件”,这个区域会显示删除控件或插入控件,具体显示那个图标在表视图委托协议的tableView:editingStyleForRowAtIndexPath:方法中设定。 为了防止用户操作失误,删除过程需要确认。删除是点击Delete按钮,才会成功删除 删除和插入单元格操作的核心是如下两个方法...

a1293的博客 244

UITableView设置Cell左滑多个按钮(编辑,删除,置顶等)

一、iOS7不支持cell多个按钮这个时候可以使用一个三方库JZTableViewRowAction,引用类扩展文件并实现其代理方法 JZTableViewRowAction下载地址:http://download.youkuaiyun.com/download/chunjunlu/9506344 - (nullable NSArray<UITableViewRowAction ...

bafa4957的博客 243

UITableView侧滑多个按钮

(NSArray )tableView:(UITableView )tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {// 添加一个删除按钮UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableVie

WolfHong的专栏 653

UITableVIew的编辑状态

#define jrRandomColor [UIColor colorWithRed:arc4random_uniform(10)*0.1 green:arc4random_uniform(10)*0.1 blue:arc4random_uniform(10)*0.1 alpha:1] #define kWidth  [UIScreen mainScreen].bounds

GuodongSun0的专栏 912

iOS个人整理19-UITableViewController和UITableView的编辑

一、UITableViewController UITableViewController是继承于UIViewController中的一个类,只不过比UIViewController中多了一个属性tableView。 也就是说UITableViewController是自带table的视图控制器。 它的self.view 是UITableView二不是UIView。 dataSource和

舍本逐末 1541
上一篇: UItableView的使用(1)
下一篇: UIApplication讲解
网上的虫
博客等级 码龄11年 8粉丝 143原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值