如何根据选择完成选择viewcontroller

编程入门 行业动态 更新时间:2024-10-24 10:19:06
本文介绍了如何根据选择完成选择viewcontroller的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

此问题与。

  • 创建自定义容器视图控制器 View Controller Programming Guide。
  • WWDC 2011 - 实现UIViewController遏制
  • 顺便说一句,埋没在视图中控制器编程指南是关于这四种遏制方法的细微说明:

    • addChildViewController:
    • removeFromParentViewController
    • willMoveToParentViewController:
    • didMoveToParentViewController:

    有一些奇怪的相互作用这里。我认为我们作为应用程序开发人员要么只是执行添加... 和/或删除... 并且iOS将为我们处理所有通知,或者我们必须处理将... 和做了...... 自己发出通知。但它实际上只有一半。请阅读非常小心地添加和删除孩子。

    This question is related to this.

    I am using KLHorizontalSelect for showing tab bar with scroll option. I have dragged new 7 View Controller on storyboard. If I select Popular, popular view controller should get displayed.

    Any idea/ suggestions on how to get this done?

    解决方案

    This is a typical example of view controller containment (where you want one view controller to present other view controllers). Navigation controllers and tab bar controllers are example of built in container controllers. But effective iOS 5, Apple opened up containment for the rest of us.

    Please see:

    • Implementing a Container View Controller in the UIViewController Class Reference.
    • Creating Custom Container View Controllers in the View Controller Programming Guide.
    • WWDC 2011 - Implementing UIViewController Containment

    By the way, buried in the View Controller Programming Guide is subtle note about those four containment methods:

    • addChildViewController:
    • removeFromParentViewController
    • willMoveToParentViewController:
    • didMoveToParentViewController:

    There are some strange interplay here. I would have thought that we, as application developers, would either just do the add... and/or remove... and that iOS would take care of all of the notifications for us, or that we would have to take care of the will... and did... notifications ourselves. But it's actually half-and-half. So read Adding and Removing a Child very carefully.

    更多推荐

    如何根据选择完成选择viewcontroller

    本文发布于:2023-10-04 04:44:01,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1467119.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:viewcontroller

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!