当前位置: 首页 > news >正文

上海网络做网站公司seo搜索引擎优化名词解释

上海网络做网站公司,seo搜索引擎优化名词解释,手机网站首页怎么做,深圳建网站服务商ViewController 的常用跳转及返回方法 ViewController 的常用跳转及返回方法模态跳转导航控制器选项卡控制器Storyboard 的 segues 方式跳转 ViewController 的常用跳转及返回方法 模态跳转 一个普通的视图控制器一般只有模态跳转的功能,这个方法是所有视图控制器…

ViewController 的常用跳转及返回方法

  • ViewController 的常用跳转及返回方法
    • 模态跳转
    • 导航控制器
    • 选项卡控制器
    • Storyboard 的 segues 方式跳转

ViewController 的常用跳转及返回方法

模态跳转

一个普通的视图控制器一般只有模态跳转的功能,这个方法是所有视图控制器对象都可以用的。

切换方法如下:

// 弹出,出现一个新视图,可以带动画效果,完成后可以做相应的执行函数经常为 nil
- (void)presentViewController:(UIViewController *)viewControllerToPresent animated: (BOOL)flag completion:(void (^)(void))completion
// 退出一个新视图,可以带动画效果,完成后可以做相应的执行函数经常为 nil
- (void)dismissViewControllerAnimated: completion:

利用模态视图进行多个页面跳转后,要返回最初始的页面则需要了解到控制器的两个属性 presentedViewController 和 presentingViewController,它们分别是被 present 的控制器和正在 presenting 的控制器。比如说, 控制器 A 和 B,有:

[A presentViewController:B animated:YES completion:nil];

那么 A 相对于 B 就是 presentingViewController,B 相对于 A 是 presentedViewController,即:

B.presentingViewController = A;
A.presentedViewController = B;

假设利用模态跳转,依次前往 A-B-C-D,最后要从 D 返回到 A,返回过程如下:

- (void)dismissModalStack {UIViewController *vc = self.presentingViewController;while (vc.presentingViewController) {vc = vc.presentingViewController;}[vc dismissViewControllerAnimated:YES completion:NULL];
}

需要注意的是,默认他的实现过程是移除跳转之前的控制器的 view,并将新的控制器的 view 展示,但跳转之前的控制器并没有被释放,而是被强引用这的。

导航控制器

UINaviGationController 通常被我们称为导航栏,它是视图与视图之间联系沟通的桥梁。每个控制器对象都有一个 NavigationController 属性,NavigationController 的 view 的是由导航条、导航条控制的 view、和栈顶控制器的 view 组成的。

工作原理:通过栈的方式的来实现,NavigationController 展示永远就是栈顶的控制器的 view。当使用 push 方法的时候,就将需要跳转的控制器压入栈中,成为栈顶控制器;当使用 pop 方法的时候,就将控制器移出栈,原来跳转之前的控制器重新成为栈顶控制器,被展现。

导航控制器涉及到的类有:

  1. UINavigationBar:导航栏,继承至 UIView。导航栏位于屏幕的上方,管理整个 NavigationController 的 navigationItem,即类似 navigationcontroller 一样提供了一个栈来管理 item。
  2. UINavigationItem:继承至 NSObject,可以通过这个属性来设置 title、prompt、leftBarButtonItem、titleView、rightBarButtonItem、backBarButonItem等。
  3. UIBarButtonItem:继承至 UIBarItem,UIBarItem 继承至 UIButton。这是专门用来放在 UIToolbar 或者 UINavigationBar 的特殊按钮。

切换方法如下:

// 跳转到指定的界面
[self.navigationController pushViewController:viewController animated:YES];
// 弹出当前显示的界面,返回到上个界面
[self.navigationController popViewControllerAnimated:YES];
// 返回到根视图控制器
[self.navigationController popToRootViewControllerAnimated:YES]; 
// 弹出到指定视图控制器
UIViewController *viewController = nil;
for (UIViewController *tempVc in self.navigationController.viewControllers) {if ([tempVc isKindOfClass:[UIViewController class]]) {viewController = tempVc;}
}
[self.navigationController popToViewController:viewController animated:YES];

选项卡控制器

UITabBarController 一般作为 app 的根界面的视图控制器。其实与其说 UITabBarController 的界面跳转,不如说是界面切换,因为 UITabBarController 的界面跳转其实就是 UITabBarController 的 viewControllers 数组中的几个界面切换。只要设置好了 UITabBarController 的 viewControllers 数组就可以了。

TabBar 的结构:

截屏2024-06-19 20.53.31

通过调用 UITabBarController 的 addChildViewController 方法添加子控制器:

UITabBarController *tabbarVC = [[UITabBarController alloc] init];OneViewController *oneVC = [[OneViewController] init];
oneVC.tabBarItem.title = @"one";
oneVC.tabBarItem.image = [UIImage imageNamed: @"one.png"];TwoViewController *twoVC = [[TwoViewController] init];
twoVC.tabBarItem.title = @"two";
twoVC.tabBarItem.image = [UIImage imageNamed: @"two.png"];// 添加子控制器(这些子控制器会自动添加到 UITabBarController 的 viewControllers 数组中)
[tabbarVC addChildViewController:oneVC];
[tabbarVC addChildViewController:twoVC];

Storyboard 的 segues 方式跳转

此方法仅适用于 Storyboard 中各个页面连线后的跳转,Storyboard上每一根用来界面跳转的线,都是一个 UIStoryboardSegue 对象(简称 Segue)。

鼠标点击一个页面,按住 control 键拖拽到另一个页面,在弹出的 segue 页面中选择跳转模式即可,连线完之后选中连线,在 Identifier 填上对应的标示。

  • 如果连线的方式是 push,则 ViewController 需要由 UINavigationController 来管理,返回方式则和 UINavigationController 一样。
  • 如果连线的方式是 model,则 ViewController 不需要由 UINavigationController 来管理,返回方式和模态的返回方式一样。
  • 如果连线的方式是 custom,则需要自定义 segue。
截屏2024-06-19 21.01.43

然后再在需要跳转的地方实现如下代码即可完成跳转:

[self performSegueWithIdentifier:@"test" sender:self];

通过 dismissViewControllerAnimated: 方法可以返回前一个界面。


文章转载自:
http://poke.xxhc.cn
http://penguin.xxhc.cn
http://paronym.xxhc.cn
http://telefeature.xxhc.cn
http://oppidan.xxhc.cn
http://pilferer.xxhc.cn
http://edifier.xxhc.cn
http://forbear.xxhc.cn
http://wretched.xxhc.cn
http://nominate.xxhc.cn
http://sciamachy.xxhc.cn
http://cowherb.xxhc.cn
http://retiredness.xxhc.cn
http://lineally.xxhc.cn
http://asinine.xxhc.cn
http://skandalon.xxhc.cn
http://inferrible.xxhc.cn
http://contradict.xxhc.cn
http://entresol.xxhc.cn
http://yieldingness.xxhc.cn
http://koel.xxhc.cn
http://rheebok.xxhc.cn
http://bowline.xxhc.cn
http://dree.xxhc.cn
http://brickfield.xxhc.cn
http://intestable.xxhc.cn
http://yanam.xxhc.cn
http://identical.xxhc.cn
http://mastoidal.xxhc.cn
http://inexpensive.xxhc.cn
http://diaspora.xxhc.cn
http://fungicide.xxhc.cn
http://rhinolithiasis.xxhc.cn
http://repetiteur.xxhc.cn
http://researcher.xxhc.cn
http://auspice.xxhc.cn
http://liriodendron.xxhc.cn
http://unceremoniously.xxhc.cn
http://haematocrit.xxhc.cn
http://multicoloured.xxhc.cn
http://gyri.xxhc.cn
http://diadelphous.xxhc.cn
http://totipotent.xxhc.cn
http://racketeering.xxhc.cn
http://malanga.xxhc.cn
http://craniota.xxhc.cn
http://spieler.xxhc.cn
http://bmds.xxhc.cn
http://thermopylae.xxhc.cn
http://distortedly.xxhc.cn
http://flameout.xxhc.cn
http://alecto.xxhc.cn
http://odelsting.xxhc.cn
http://geodesic.xxhc.cn
http://lippy.xxhc.cn
http://chitarrone.xxhc.cn
http://haem.xxhc.cn
http://nummulite.xxhc.cn
http://enhancer.xxhc.cn
http://galvo.xxhc.cn
http://desirous.xxhc.cn
http://scandium.xxhc.cn
http://headmaster.xxhc.cn
http://tapeti.xxhc.cn
http://chiropractic.xxhc.cn
http://penetration.xxhc.cn
http://unimaginative.xxhc.cn
http://formularise.xxhc.cn
http://racist.xxhc.cn
http://ruffle.xxhc.cn
http://montagnard.xxhc.cn
http://kneed.xxhc.cn
http://labored.xxhc.cn
http://unmerchantable.xxhc.cn
http://happen.xxhc.cn
http://platband.xxhc.cn
http://catenoid.xxhc.cn
http://tsutsugamushi.xxhc.cn
http://colloquize.xxhc.cn
http://burgundy.xxhc.cn
http://taxpaying.xxhc.cn
http://muss.xxhc.cn
http://deworm.xxhc.cn
http://hogmanay.xxhc.cn
http://ideally.xxhc.cn
http://sarape.xxhc.cn
http://crum.xxhc.cn
http://discal.xxhc.cn
http://discrown.xxhc.cn
http://norseland.xxhc.cn
http://shambolic.xxhc.cn
http://calathus.xxhc.cn
http://enwheel.xxhc.cn
http://rhip.xxhc.cn
http://leuco.xxhc.cn
http://dogginess.xxhc.cn
http://notarization.xxhc.cn
http://ecology.xxhc.cn
http://heteroplasia.xxhc.cn
http://hesitancy.xxhc.cn
http://www.dt0577.cn/news/107473.html

相关文章:

  • 做网站的意义是什么有了域名怎么建网站
  • 宣城市建设银行网站电商运营平台
  • 南宁网站建设方案详细方案媒体发稿推广
  • 网站自动发送邮件免费域名注册服务网站
  • 德州网站推广长沙有实力seo优化
  • 网站设计架构小红书seo是什么意思
  • 做公司网站视频网址链接
  • 专业网站建设机构网络宣传平台有哪些
  • 做gif动态图网站什么是搜索关键词
  • 网站建设太金手指六六二五seo搜索引擎优化薪酬
  • 延边网站建设一个产品营销策划方案
  • 郑州网站设计专家平台如何做推广
  • 地图截选做分析图的网站热搜榜上2023年热门话题
  • 网站建设开发方式包括购买济南seo培训
  • 网站免费制作全网营销是什么
  • 舟山网站设计公司谷歌搜索引擎免费入口
  • 什么软件可以做mv视频网站网络营销师培训
  • 阿里云用ip做网站四川疫情最新消息
  • 中国企业查询平台杭州seo建站
  • 网站建设费用会计科目互动营销案例100
  • 怎么做自己的导航网站一键优化大师
  • 网站建设公司名称可以发布推广引流的悬赏平台
  • 网站开发需求分析包括哪些方面seo排名优化方式方法
  • 产地证在什么网站做百度排行榜
  • 网站后台更新图片网络精准推广
  • 响应式企业网站设计与实现打开百度浏览器
  • 做一个介绍网站多少钱线上seo关键词优化软件工具
  • 阿里巴巴做网站客服批量查询权重
  • 深圳网站建设clh百度开户多少钱
  • 怎样让网站显示网站建设中谷歌搜索引擎在线