IOS详解TableView——选项抽屉(天猫商品列表)

IOS详解TableView——实现九宫格效果 根据需求九宫格的效果可以有很多种。 这里写了一个在UITableView上显示九宫格效果的Demo。 思路:在Cell上初始化自定义过得按钮,根据预设的每行按钮个数来决定他们在Cell上的位置。然后响应点击事件即可。整体实现不是很难,细节上注意一下即可。 搭建界面 数据,图片来自于天猫客户端的一些资源图片,然后还是以属性字典的方式读取提前设定的数据。 阅读详情



在之前的有篇文章讲述了利用HeaderView来写类似QQ好友列表的表视图。

这里写的天猫抽屉其实也可以用该方法实现,具体到细节每个人也有所不同。这里采用的是点击cell对cell进行运动处理以展开“抽屉”。

最后完成的效果大概是这个样子。



主要的环节:

点击将可视的Cell动画弹开。

其他的Cell覆盖一层半透明视图,将视线焦点集中在弹出来的商品细分类别中。

再次点击选中的或其他Cell,动画恢复到点击之前所在的位置。

商品细分类别属于之前写过的九宫格实现。这里就不贴代码了。之前的文章:点击打开链接


这里的素材都来自之前版本天猫的IPA。

加载数据


- (void)loadData
{
    NSString *path = [[NSBundle mainBundle] pathForResource:@"shops" ofType:@"plist"];
    NSArray *array = [NSArray arrayWithContentsOfFile:path];
    
    NSMutableArray *arrayM = [NSMutableArray arrayWithCapacity:array.count];
    [array enumerateObjectsUsingBlock:^(NSDictionary *dict, NSUInteger idx, BOOL *stop) {
        ProductType *proType = [[ProductType alloc] init];
        proType.name = dict[@"name"];
        proType.imageName = dict[@"imageName"];
        proType.subProductList = dict[@"subClass"];
        
        [arrayM addObject:proType];
    }];
    self.typeList = arrayM;
}


一个ProductType数据模型,记录名称,图片名称等。


单元格数据源方法

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    TypeCell *cell = [tableView dequeueReusableCellWithIdentifier:RTypeCellIdentifier];
    [cell bindProductKind:_typeList[indexPath.row]];
    return cell;
}

将数据模型的信息绑定到自定义类中进行处理,这个类在加载视图之后由tableview进行了注册。

iOS 仿百度外卖,饿了么-商品列表页 今天带来的是仿百度外卖的商品列表页 先看下效果图 阅读详情

相关推荐

iOS基础专栏目录指南之【基础模块】(持续更新)

文章目录引言I、 Objective-C1.1 对象模型1.2 动态特性(runtime)II、 UI基础2.1 UIKit基础控件手册2.2 系统控件的基本使用及常见问题的解决方案III、 UI进阶3.1 自定义MVVM视图IV、 iOS权限检测指南V、 调试VI、 swift 引言 I、 Objective-C Objective-C 的原意就是在 C 语言主体上加入面向对象的特性。 任何 C 语言程序不经修改就可以直接通过 Objective-C 编译器,在 Objective-C 中使用 C

专注于计算机研发知识和资讯分享 2992

ios-uitableView实现抽屉样式.zip

1.简单的抽屉样式。 2.只是简单的技术分享,不喜欢可以绕道,不喜勿喷。

ios-仿京东 列表选择城市列表 自带三级联动城市数据.zip

仿京东 列表选择城市列表 自带三级联动城市数据

ios-【联动】:两个TableView之间的联动,TableView与CollectionView之间的联动.zip

【iOS联动】新增功能:用户点击了左侧tableView中靠下的cell时,选中的cell会自动向上滚动。 github下载链接:https://github.com/leejayID/Linkage(欢迎Star,长期更新)。

swift-tableview抽屉点击cell弹出n个子cell依次类推支持cell行高自适应

tableview抽屉,点击cell弹出n个子cell,依次类推,支持cell行高自适应。。。一个不一样的思路

ios-购物车 两个tableView的联动 tableView和collectionView的联动.zip

购物车 两个tableView的联动 tableView和collectionView的联动

ios-轻松实现两个 TableView的联动.zip

由于TableView是最常用的控件,所以封装起来方便使用

iOS 抽屉效果 毛玻璃效果 下拉筐效果 高仿网易新闻

iOS 抽屉效果 毛玻璃效果 下拉筐效果 高仿网易新闻

iOS SwipeKit,帮你轻松实现滑动展开抽屉效果.zip

iOS SwipeKit,帮你轻松实现滑动展开抽屉效果。.zip,swipableuitableviewcell/uicollectionviewcell基于stock mail.app,在swift中实现。

这是一个很简单的抽屉栏效果

这是一个非常简单的抽屉栏效果的小demo 很容易可以嵌入你的项目中,

机器学习kaggle案例:风控评分卡模型(Give_Me_Some_Credit)

kaggle链接:https://www.kaggle.com/c/GiveMeSomeCredit ipynb文件:https://github.com/824024445/KaggleCases/blob/master/%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0kaggle%E6%A1%88%E4%BE%8B%EF%BC%9A%E9%A3%8E%E6%8E%A7%...

weixin_42662126的博客 1万+

储能EMS工作原理深度剖析:功率分配与充放电策略的底层逻辑

储能EMS的功率分配与充放电策略,是其智能化的集中体现。功率分配更像一个“执行指挥官”,关注如何将总任务高效、公平、安全地分解到每个士兵(PCS/电池簇);而充放电策略则像“总参谋长”,基于战场情报(市场、电网、自身状态)制定最优的作战计划。AI强化学习策略:让EMS通过与复杂环境不断交互,自主学习最优策略,适应不确定性。数字孪生与仿真:在虚拟空间中提前验证策略,评估风险,实现预防性控制。跨站协同优化:多个储能站的EMS通过云平台协同,参与区域电网甚至跨省市场的联合优化调度。

小帽子的博客 375

树莓派4B+DroneKit实战:手把手教你用Python控制无人机飞行(附避坑指南)

本文提供了一份详尽的树莓派4B与DroneKit配置实战指南,涵盖从硬件选型、软件环境搭建到Python编程控制无人机的完整流程。文章重点解决了ARM架构下的兼容性问题、MAVLink通信配置及端口管理等常见难题,并附带了实用的避坑指南和代码示例,帮助开发者构建稳定可靠的无人机控制系统。

weixin_29056781的博客 410

【maxENT】从数据到地图:R语言实现最大熵物种分布建模全流程解析

本文详细解析了如何使用R语言实现最大熵模型(MaxEnt)进行物种分布建模的全流程。从数据准备、环境变量处理到模型训练与参数调优,再到模型评估与结果可视化,提供了实用的代码示例和避坑指南。特别适合生态学研究者利用最大熵模型处理物种分布数据,提升研究效率。

weixin_27244795的博客 216

ESP-IDF下载配合MQTT协议接入云平台实例

通过ESP-IDF下载环境搭建,结合MQTT协议实现设备与云平台通信,详解从配置到连接的完整流程,助力物联网应用开发。重点涵盖espidf下载和MQTT集成关键步骤。

weixin_28913879的博客 454

调用D3D11硬解码和渲染VideoProcessor版本

在https://blog.youkuaiyun.com/robothn/article/details/78781321一文中使用shader来显示FFMPEG硬解码后的YUV420P,本文调用D3D11的videoprocessor来进行图像空间变换和尺寸变换,取得了较好的效果。 1.初始化D3D11设备、videodevice等数据结构 FFMPEG调用D3D11硬解码,获取其对应的device,videodevice。。。 FFMPEG使用av_hwdevice_find_type_by_name调用D3d11

zlyadvocate的博客 9285

Spring AI Alibaba 1.x 源码分析-架构设计

本文通过分析Spring AI Alibaba 框架的源码,分析出其原理和架构设计,无论是用于项目开发、技术评估还是团队培训都具有重要价值。

program哲学 490

基于生存结局(生存分析/COX回归)的中介效应分析

① 建立观察变量OVB和中介变量MVB的回归模型(注意:这里根据mediation包的介绍,需要构建的是probit模型,而不是logist回归模型,网上有很多的代码用的logistic回归,结果自己跑的时候发现报错,我在这里陷了很久;为了方便演示,我们生成了一个协变量(Age)、一个连续型观察变量(liaOVC)、一个二分类观察变量(OVB)、一个连续型中介变量(MVC)、一个二分类中介变量(MVB)以及最后的结局变量(生存时间[time],生存结局[stats])。

m0_61863309的博客 1万+

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

深度学习工具包 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")

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

温度PID控制PLC程序

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

上一篇: ARM相关知识
下一篇: IOS飞机大战OC版
RannieR
博客等级 码龄14年 180粉丝 68原创
评论 5
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值