addChildViewController的使用

LTspice基础教程-009.LTspice波形测量 <<==上一篇:LTspice基础教程-008.LTspice PWL设置 >>==下一篇:LTspice基础教程-010. 首篇博客文末提供所有相关资源百度网盘分享链接 阅读详情
在苹果的WWDC2011大会视频的 《Session 101 – What’s New in Cocoa》 和 《Session 102 – Implementing UIViewController Containment》 中介绍了苹果在iOS5中给UIViewController新增加的5方法以及一个属性:
// 方法
addChildViewController:
removeFromParentViewController:
transitionFromViewController:toViewController:duration:options:animations:completion:
willMoveToParentViewController:
didMoveToParentViewController:
// 属性
@property(nonatomic,readonly) NSArray *childViewControllers


原来的问题

这些新增的方法和属性用于改进我们的编程方式。那么让我们先看看以前的对于UIViewController的使用有什么潜在的问题,认清问题,我们才能理解苹果改变的意义。

在以前,一个UIViewController的View可能有很多小的子view。这些子view很多时候被盖在最后,我们在最外层ViewController的viewDidLoad方法中,用addSubview增加了大量的子view。这些子view大多数不会一直处于界面上,只是在某些情况下才会出现,例如登陆失败的提示view,上传附件成功的提示view,网络失败的提示view等。但是虽然这些view很少出现,但是我们却常常一直把它们放在内存中。另外,当收到内存警告时,我们只能自己手工把这些view从super view中去掉。

改变

苹果新的API增加了addChildViewController方法,并且希望我们在使用addSubview时,同时调用[self addChildViewController:child]方法将sub view对应的viewController也加到当前ViewController的管理中。对于那些当前暂时不需要显示的subview,只通过addChildViewController把subViewController加进去。需要显示时再调用transitionFromViewController:toViewController:duration:options:animations:completion方法。

另外,当收到系统的Memory Warning的时候,系统也会自动把当前没有显示的subview unload掉,以节省内存。


【即插即用模块】Transformer篇 | AAAI 2026 | Circulant Attention:全新ViT自注意力范式,复杂度从O(N²) 降至O(NlogN)! 本文提出了一种基于频域优化的循环注意力模块(Circulant Attention),通过离散傅里叶变换(DFT)将传统自注意力中的矩阵乘法转化为频域元素乘法,显著降低了计算复杂度。该模块采用复数线性层适配频域特征,并引入门控调制机制增强表达能力,在保持全局依赖捕捉能力的同时,将复杂度从O(N²)降至O(NlogN)。实验表明,该模块在多种视觉任务中均能提升模型性能,且计算效率更高。适用于需要高效全局注意力的视觉Transformer架构,可作为传统自注意力的替代方案。 阅读详情

相关推荐

用VASPKIT+Quantum Espresso高效绘制能带图:从K点路径生成到可视化全流程

本文详细介绍了如何整合VASPKIT与Quantum Espresso(QE)软件,构建一套高效的能带计算与可视化工作流。通过VASPKIT自动化生成高对称K点路径,结合QE完成自洽与非自洽计算,并利用gnuplot绘制发表级能带图。该流程极大提升了材料电子结构研究的效率与可重复性,是进行DFT能带计算的实用指南。

weixin_29294975的博客 163

iOS_5.0新特性_UIViewController切换

前言 在苹果的WWDC2011大会视频的 《Session 101 - What’s New in Cocoa》 和 《Session 102 - Implementing UIViewController Containment》 中介绍了苹果在iOS5中给UIViewController新增加的5方法以及一个属性: // 属性 @property(nonatomi

teletian的专栏 2463

宇树机器狗go2—slam建图(1)点云格式

上一篇番外文章教大家如何在宇树机器狗go2的gazebo仿真环境中实现简单的导航运动,本期文章会教大家如何让宇树的机器狗go2在仿真环境中进行slam建图时经常会遇到的一些点云格式,在后续的slam建图和slam算法解析的时候会经常与这些点云信息打交道。宇树机器狗go2仿真会作为一个长期项目来进行不定期更新,仿真不只限于在gazebo上实现,后面还会在isaac sim等仿真平台上教大家如何搭建,其目的还是帮助各位都能以较低的成本加入到宇树机器狗go2的学习中。

古月居 3271

笔记:iOS中addChildViewController的使用

iOS早在iOS5的时候为了解耦、更加清晰的处理页面View的逻辑,UIViewController提供了addChildViewController方法,将ViewController作为容器处理视图控制器的切换,将比较复杂的UI使用子ViewController来管理。 iOS5.0之前只能在ViewController的view中不断的通过addSubView添加subView到VC的view视图层级中。这样使得主ViewController中的内容越来越混乱,代码越来越多,subView的管理越来

2803

基于单片机电能质量检测仪设计

*单片机设计介绍,基于单片机电能质量检测仪设计。

2201_75940997的博客 1205

Centos 7 Linux 安装单机 Hadoop(HDFS):下载、安装、配置、测试

本文详细介绍了在 CentOS 7 系统上安装与配置单机 Hadoop(HDFS)的完整流程,涵盖 JDK 环境准备、Hadoop 安装包下载与部署、核心配置文件(core-site.xml、hdfs-site.xml 等)修改、SSH 免密登录设置、HDFS 格式化及服务启动,并通过命令行与 Web 界面验证 HDFS 和 YARN 功能,适合 Hadoop 初学者快速搭建本地测试环境。

寒水馨 · 轻量级技术文档 · hanshuixin.org 3237

Swift4升级到Swift4.2修改内容记录

本文记录了将工作项目由Swift4版本升级到Swift4.2中修改的内容,需要修改876处错误: ‘UIImageOrientation’ has been renamed to ‘UIImage.Orientation’ ‘UIApplicationWillResignActive’ has been renamed to ‘UIApplication.willResignActiveNot...

阿党的专栏 1408

YOLOv8【第七章:损失函数篇·第1节】一文搞定,IoU系列损失函数!

🏆 本文收录于 《YOLOv8实战:从入门到深度优化》 专栏。该专栏系统复现并梳理全网各类 YOLOv8 改进与实战案例(当前已覆盖分类 / 检测 / 分割 / 追踪 / 关键点 / OBB 检测等方向),坚持持续更新 + 深度解析,质量分长期稳定在 97 分以上,可视为当前市面上 覆盖较全、更新较快、实战导向极强 的 YOLO 改进系列内容之一。

**My Coding Family** 1199

AddChildViewCtroller

AddChildViewCtroller切换 View。

小桥流水哗啦啦,iOS Coder 哒哒哒 1310

视图库对接系列(GA-T 1400)四、视图库对接系列(本级)注册

在之前的步骤中,我们已经把项目大体的架构已经写出来了。那我们就来实现注册接口。GA-T 1400中的步骤如下:这里的话,我们实现的简单点, 我们不进去鉴权,也就是设备或平台找我们注册的话,我们直接返回成功,不进行验证。如果需要鉴权的话可看我的另外一篇文档。

qq_37716298的博客 1044

深入Netflix影片分类数据抓取的Python爬虫实战:反反爬机制绕过与Playwright应用全解析

技术工具用途Playwright控制真实浏览器模拟用户行为开发语言asyncio异步调度浏览器任务pandas数据处理和导出sqlite3本地数据库存储支持随机UA模拟,增强反爬能力为什么选择 Playwright?✅ 支持多浏览器(Chromium、Firefox、WebKit)✅ 原生支持 Python 异步编程✅ 提供截图、滚动模拟、验证码处理等高级功能✅ 反爬能力强,模拟真实用户访问。

2201_76125261的博客 1239

ios5中UIViewController addChildViewController新方法的使用[转]

在ios5中,ViewController中新添加了下面几个方法: addChildViewController: removeFromParentViewController transitionFromViewController:toViewController:duration:options:animations:completion: willMoveToParentVie...

lcdxwhj2003的专栏 290

YOLOv11改进策略【卷积层】| SPD-Conv 针对小目标和低分辨率图像的检测任务

SPD-Conv是一种新的 CNN 构建模块,用于替代传统 CNN 架构中使用的步长卷积(strided convolution)和池化(pooling)层,它由空间到深度(Space-to-depth,SPD)层和非步长卷积(non - strided convolution)层组成。

Limiiiing的博客 4975

iOS中addChildViewController的使用

A父视图控制器 addChildViewController:B子视图控制器]在视图控制器A中添加了子视图控制器B.调用这个方法时如果子视图控制器已经有父视图控制器了,那么调用该方法会先把子视图控制器从之前的父视图控制器中移除,然后再添加到当前的视图控制器上作为子视图控制器。当从一个视图控制容器中添加或者移除viewController后,该方法被调用;当一个视图控制器从视图控制器容器中被添加或者被删除之前,该方法被调用parent:父视图控制器,如果没有父视图控制器,将为nil;

lmyuanhang的专栏 748

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

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

精雕软件(JDpaint) 5.5 绿色版

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

addChildViewController

苹果新的API增加了addChildViewController方法,并且希望我们在使用addSubview时,同时调用[self addChildViewController:child]方法将sub view对应的viewController也加到当前ViewController的管理中。对于那些当前暂时不需要显示的subview,只通过addChildViewController把subVi

476

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

addChildViewController: VS addSubview:

前言最近看大神们的博客时,发现一个之前一直没注意到的API:addChildViewController:很有用武之地,很大程度上弥补了经验不深的开发者(ps:说得好像不是我一样!)常使用的addSubview:的不足,而且Apple官方也希望我们在使用[self.view addSubview:XX]的同时调用[self addChildViewController:XX]。 addChildV

ZeroOnet的博客 1425

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

addChildViewController方法

ios中UIViewController addChildViewController新方法的使用   在ios5中,ViewController中新添加了下面几个方法: addChildViewController:  removeFromParentViewController  transitionFromViewController:toViewController

在路上 1382

使用addChildViewController时出现的问题

ios5.0之后可以使用addChildViewController  self.inboxController=[[NoticeInboxViewController alloc] initWithNibName:@"NoticeInboxViewController" bundle:nil];     [self addChildViewController:self.inb

yesjava的专栏 7462

addchildviewcontroller管理视图

有些时候,在和其他工程整合时没办法得到当前的视图控制器进行操作,通过addchildcontroller将视图控制器收集起来统一管理是个很不错的办法。 比如最近有个工程,要和u3d进行整合,首页界面是u3d做的然后在xcode进行扩张,跳转到新的视图控制器必须能返回,当然一级跳转可以直接模态消失,但有二级跳转回首页就出现问题了。首页—登录—详情。详情的返回要回到首页而不是登录。所以首先想到的是通

孙元洋的专栏 2074

使用addChildViewController手动控制UIViewController的切换

使用addChildViewController手动控制UIViewController的切换 addChildViewController If the new child view controller is already the child of a container view controller, it is removed from that conta

u013538732的专栏 638

iOS addChildViewController 使用

如果当前页面添加了其他ViewController的view 一定要使用 addChildViewController 不然内存无法释放.

sch1111878的专栏 571

addchildviewcontroller

在iOS5中,ViewController中新添加了下面几个方法:  addChildViewController:是UIViewController的一个方法,iOS5之后加入的,使用这个方法可以达到addsubView一样的效果,而且好处多多 addChildViewController的好处: 1.无疑,对页面中的逻辑更加分明了。相应的View对应相应的ViewCon

305

addChildViewController后 Childvc viewWillAppear 不调用的问题

addChildViewController viewWillAppear

allanGold 2140

addChildViewController用法

/*      苹果新的API增加了addChildViewController方法,并且希望我们在使用addSubview时,同时调用[self addChildViewController:child]方法将sub view对应的viewController也加到当前ViewController的管理中。      对于那些当前暂时不需要显示的subview,只通过addChi

liu__000的专栏 3898

iOS addChildViewController 详解

突然发现公司小弟对 addChildViewController这个方法居然不怎么了解,找了篇帖子 记录下。 [objc] view plain copy   //   //  YYMainViewController.m   //  UIScrollView   #import "YYMainViewController.h"  

Bob的专栏 2万+

IOS5中的addChildViewController

在看oschina客户端的源代码的时候,发现了一个新发方法。ji

ralbatr的专栏 2475
上一篇: NSJSONSerialization介绍
下一篇: 如何让view只响应一个按钮
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值