iOS开发之presentViewController、presentModelViewController和pushViewController

Win10安装Nek5000 1 安装wsl 2 2 安装Nek5000 3 安装依赖项 4 安装openmpi 5 配置Nek5000 6 编译Nek5000 7 运行Nek5000算例 8 安装paraview并查看结果 阅读详情

本来这个应该是昨天发出来的,昨天时间来不及就放到今天发了。

昨天在开发中遇到一个问题:从ViewController push一个视图,返回的时候返回不了;查看代码发现push方法、pop方法都没问题;话不多说,直接上代码:

- (void)AddNewFeedBacks

{

FeedBackViewController *feedBackView = [[FeedBackViewController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:feedBackView];
[self.navigationController presentViewController:nav animated:YES completion:nil];
}

- (void)popBack

{

    [self.navigationController popViewControllerAnimated:YES];

}

UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"reback.png"] style:UIBarButtonItemStylePlain target:self action:@selector(popBack)];

self.navigationItem.leftBarButtonItem = leftItem;

方法控件都没问题;这时候就不得不断点来看,结果发现到popBack方法的时候这个方法没生效,于是查看了navigationController的一些push、pop方法结果发现了问题出在退出视图,也就是[self.navigationController presentViewController:nav animated:YES completion:nil];这里。

然后去查看了下相关api发现这两个方法的区别:

这两个方法都是必须要ViewController, 是建立在UINavigationController之上的。
SQLiteViewController *baSQLiteViewController = [[SQLiteViewController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:baSQLiteViewController];
[self.window addSubview:nav.view];

推出视图push,下一页面会自动添加返回按钮
InforViewController *baInforViewController = [[InforViewController alloc] init];
[self.navigationController pushViewController:baInforViewController animated:YES];

 

以Modal方式推出一个视图,弹出的视图没有返回按钮,需要自己添加
NewDataViewController *baNewViewController = [[NewDataViewController alloc] init];
UINavigationController *baNavigation = [[UINavigationController alloc] initWithRootViewController:baNewViewController];
[self.navigationController presentModalViewController:baNavigation animated:YES];
[baNewViewController release];
[baNavigation release];

为弹出视图添加返回按钮
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"返回" style:UIBarButtonItemStyleDone target:self action:@selector(returnView)];

返回方法
- (void)returnView

{
    [self.parentViewController dismissModalViewControllerAnimated:YES];
}





【YOLO系列】YOLOv5超详细解读(源码详解+入门实践+改进) 一文带你详细了解YOLOv5(含YOLO系列论文讲解+源码详解+入门实践+算法改进) 阅读详情

相关推荐

量化实战:用三种波动率模型给你的期货策略做个“体检”(附Python代码与螺纹钢案例)

本文深入探讨了三种专业波动率模型(Parkinson、Garman-Klass和Rogers-Satchell)在期货量化策略中的应用,并以螺纹钢期货为例,展示了如何通过Python实现这些模型进行多维度波动率分析。文章详细比较了不同模型的特点和适用场景,提供了动态仓位管理、止损策略优化等实战应用方案,帮助交易者更精准地评估市场风险,优化策略表现。

weixin_26824299的博客 460

pushViewController

1. 用UINavigationController的时候用pushViewController:animated ----返回之前的视图[[self navigationController] popViewControllerAnimated:YES]; ---ps:push以后会在navigation的left bar自动添加back按钮,它的响应方法就是返回。所以一般不需要写返回方法,

坚持的专栏 1236

使用 Python 爬取 YouTube 视频评论(弹幕)

✅ 如何使用 Python 调用 YouTube Data API v3。✅ 如何爬取指定视频的所有评论信息。✅ 如何对评论数据进行初步分析与可视化。✅ 如何扩展功能,实现评论回复获取和多视频批量爬取。

2201_76125261的博客 645

iOS pushViewController 和 presentViewController

在iOS的界面切换中我们经常使用push和present方法那么这两个有什么区别呢? 首先 present与dismiss对应 push和pop对应。 他们的存储也有区别 pushViewController 导航控制器入栈的方式切换页面 presentViewController 模态切换的方式切换页面 模态的定义 功能区别 present只能逐级返回,push所有视图由视图栈控制,可以返回...

weixin_44824650的博客 2130

推荐11个顶级的Claude Code Skills

ClaudeCode的Skills系统为程序员提供了11个强大的AI辅助工具,包括代码审查、重构建议、单元测试生成、API文档自动生成、性能分析、安全扫描、数据库迁移脚本生成、CI/CD配置、依赖管理、ER图生成和日志分析等功能。这些"技能包"可大幅提升开发效率,从代码质量到协作沟通全方位优化工作流程。用户可根据需求选择2-3个核心功能开始尝试,熟练后还可自定义Skills。该系统需要配合Anthropic的API使用,建议先在小型项目测试再应用于核心业务。

分享AI、区块链技术及应用,未来已来 1853

YOLOv13改进策略【Head】| (独家改进)结合 ICME-2024 中的PPA注意力模块,自研带有注意力机制的小目标检测头

本文记录的是利用PPA (并行补丁感知注意模块)改进YOLOv13的检测头。通过改进传统卷积,形成带有注意力机制的小目标检测头,使模型能够更好地关注小目标的重要信息。HCF-Net: Hierarchical Context Fusion Network for Infrared Small Object Detection采用多分支特征提取策略,通过不同分支提取不同尺度和层次的特征。利用局部、全局和串行卷积分支,对输入特征张量进行处理。通过控制 patch size参数实现局部和全局分支的区分,计算非重叠

Limiiiing的博客 480

【iOS】push与present Controller的区别

iOS推出与退出界面有两种方式——push与present,接下来笔者分别介绍这两种方式。

weixin_72437555的博客 1003

如何让 Mac mini 24小时不休眠运行 OpenClaw

如果 OpenClaw 每 5-10 分钟自动退出,launchd 连续 4 次快速重启后会判定为崩溃循环并卸载服务。:方案一(pmset)+ 方案三(launchd)组合使用,既防止系统休眠,又保证 OpenClaw 开机自启和崩溃自动恢复。:caffeinate 只在进程运行期间有效,终端关闭或进程结束后系统恢复正常睡眠策略。这条命令会自动创建 launchd plist 并启用服务,是最推荐的方式。替换为你的实际用户名路径,Node.js 路径也要改成你自己的。确保 plist 中有。

Maynor的博客 2215

【iOS】pushViewController没反应

调试发现 self.navigationController为nil。试了几种方式初始化一个navi赋值都不行,各种crash。在board里选中首页的ViewController,之后Editor-Embedded in- Navigation Controller。最近为了验证一个问题是不是系统bug,写了一个小demo,结果发现跳转controller的时候没反应。配置之后,上面的pushViewController代码就会生效啦~

不想做菜鸟的小螃蟹 1147

ROS & ROS2 机器人深度相机激光雷达多传感器标定工具箱

不过,多传感器标定工具箱允许通过编辑 yaml 文件来调整标定目标的参数: <repository>/mutlisensor_calibration/cfg/TargetWithCirclesAndAruco.yaml%YAML:1.0rows: 4cols: 1dt: irows: 4cols: 2dt: frows: 1cols: 12dt: fCAD 模型网格/云通过 GICP 将模型数据与分割点云对齐,用于优化检测到的目标姿态。

2506_90492529的博客 2108

大数据Alluxio面试题及参考答案

Alluxio 在大数据生态里的定位是作为数据编排层,能在不同计算框架和存储系统之间起到桥梁的作用。它的核心功能在于加速数据访问,让大数据应用能够更高效地使用数据。Alluxio 把数据存储和数据处理分离开来,使计算框架可以在不考虑底层存储细节的情况下访问数据,这样就提高了系统的灵活性和可扩展性。Alluxio 和 HDFS 既存在关联又有区别。从关联方面来看,HDFS 是一种广泛使用的分布式文件系统,很多大数据应用都将其作为主要的数据存储系统。Alluxio 可以和 HDFS 集成,把 HDFS 当作底层

大模型大数据攻城狮的专栏 862

ViewController之间通信,传递参数

从FirstViewController跳转到SecondViewController,当从SecondViewController返回时,如果想把数据回传给FirstViewController,可以用代理的方法,FirstViewController中这样使用:FirstViewController.h @interface FirstViewController : UIViewControl

静影沉璧 3916

996引擎 - 读写变量性能测试

单轮100万次读写,取3轮平均耗时(毫秒),有效读取率均为100%,数值越小性能越优。

灵台方寸山斜月三星洞 244

pushViewController/presentModalViewController/addSubView区别及使用方法

1. 用UINavigationController的时候用pushViewController:animated ----返回之前的视图[[self navigationController] popViewControllerAnimated:YES]; ---ps:push以后会在navigation的left bar自动添加back按钮,它的响应方法就是返回。所以一般不

roverk8y的专栏 1039

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

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

IOS pushViewController如何去隐藏tabbar

IOS pushViewController如何去隐藏tabbar 一。使用storyboard 去push 一个viewController的时候,可以勾选 找到对应的viewController,找到属性,找到Hide Bottom Bar on Push,默认是没有勾选, 现在勾选上,点击tableViewCell的时候,就会隐藏,一定要选中对应的ViewController 二,对于使用storyboard加载还是xib加载,还是纯代码加载的。可以重写 navigationController里

A1521315qwss的博客 1165

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

iOS开发Swift-UITableView-navigationController?.pushViewController(fileOperation, animated: true)

navigationController?.pushViewController(fileOperation, animated: true) 通过导航控制器(navigationController)将一个新的视图控制器(fileOperation)推入栈顶,同时以动画的形式展示这个过程。如果navigationController为nil,那么pushViewController操作将不...

LYly_B的博客 401

「iOS」push与present

iOS界面推出与弹出的总结

2301_80253909的博客 1797

ios中界面的跳转presentedViewController 、pushViewController及实现返回关闭当前页面

基本介绍 1、有NavigationController导航栏的话,使用[self.navigationColler pushViewController:animated:];和[self.navigationController popViewControllerAnimated:];来进行视图切换。pushViewController是进入到下一个视图,popViewController是...

haoxuhong的博客 9334

在UIView页面执行pushViewController操作

由于UIView没有navigationController属性,所以不能直接push操作 这里介绍两种解决方案,第一种是常用的block: 1.在UIView的.h文件中定义一个bock属性:@property (nonatomic, copy)void(^MoreSearchblock)(); 2.在UIView的.m文件的要push操作的方法中执行block:self.MoreSearc...

ly410726的专栏 4164

iOS开发进阶(十一):ViewController 控制器详解

iOS 界面开发最重要的首属和View是View的控制器,也就是一般的页面,用来管理页面的生命周期(它相当于安卓里的Activity,两者很像,但又有一些差异)。的特点是它有好几种。一种最基本的。所谓容器,就是它们本身不能单独用来显示,必须在里面放一个或几个。用于导航栏管理页面;用于底部tab管理页面;用于切换器管理页面;容器还可以嵌套,比如把放进里面,这样在tab页面里,可以用启动导航栏样式的二级子页面。

IT全栈 华强工作室 3062

iOS-正确使用PresentModalViewController

Present ViewController Modally 一、主要用途   弹出模态ViewController是IOS变成中很有用的一个技术,UIKit提供的一些专门用于模态显示的ViewController,如UIImagePickerController等。弹出模态ViewController主要使用于一下这几种情形:   1、收集用户输入信息   2、临时呈现一些内

花若盛开,蝴蝶自来! 790

新视图 pushViewController presentModalViewController 用法

这两个方法都是必须要ViewController, 是建立在UINavigationController之上的。 SQLiteViewController *baSQLiteViewController = [[SQLiteViewController alloc] init]; UINavigationController *nav = [[UINavigationController al

尘雨::执着VC 1万+

导航控制器,pushViewController 的转场动画

与 ViewController 的 present 转场动画不同 1, 导航控制器,pushViewController 的转场动画,的代理是 navigationController?.delegate = self 2, 指定动画的方法 extension Two: UINavigationControllerDelegate{ func navigationController(_ navigationController: UINavigationController, ani

dengjiangszhan的博客 543

PresentViewController切换界面

视图切换,没有NavigationController的情况下,一般会使用presentViewController来切换视图并携带切换时的动画, 其中切换方法如下: – presentViewController:animated:completion: 弹出,出现一个新视图 可以带动画效果,完成后可以做相应的执行函数经常为nil – dismissViewControllerAn

5万+

IOS项目中几个常见的架构(MVC等)

一、MVC 001 概念 Model-view-controller View:管理作为位图展示到屏幕上的图形和文字输出 Controller:翻译用户的输入并依照用户的输入操作和视图 Model:管理应用的行为和数据,响应数据请求和更新状态的指令 来源 002 特点 优势:分离视图层和模型层之间的耦合,作为数据存储功能的模型层,可以通过控制器同时为多个不同视图提供数据 GUI应用程序可以分成两个部分:一部分用于展现内容的展现层。另一部分包含领域层和数据逻辑层 Presentatio.

Coding_Physical的专栏 578

iOS开发之Present ViewController Modally --弹出模态ViewController

一、主要用途   弹出模态ViewController是IOS变成中很有用的一个技术,UIKit提供的一些专门用于模态显示的ViewController,如UIImagePickerController等。弹出模态ViewController主要使用于一下这几种情形:   1、收集用户输入信息   2、临时呈现一些内容   3、临时改变工作模式   4、相应设备方向变化(用于针对不同方向

WHY_IOS的专栏 3万+

IOS之使用纯代码push ViewController

IOS之使用纯代码push ViewController LJSettingController *set = [[LJSettingController alloc]init]; [self.navigationController pushViewController:set animated:YES]; 跟用storyboard 连线是一个效果

A1521315qwss的博客 808
上一篇: 2015年的一些计划
下一篇: Android开发之按键控制
PC-鹏程万里
博客等级 码龄16年 11粉丝 9原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值