<tfoot id='R2Ey0'></tfoot>

    • <bdo id='R2Ey0'></bdo><ul id='R2Ey0'></ul>

      <legend id='R2Ey0'><style id='R2Ey0'><dir id='R2Ey0'><q id='R2Ey0'></q></dir></style></legend>

      <small id='R2Ey0'></small><noframes id='R2Ey0'>

      <i id='R2Ey0'><tr id='R2Ey0'><dt id='R2Ey0'><q id='R2Ey0'><span id='R2Ey0'><b id='R2Ey0'><form id='R2Ey0'><ins id='R2Ey0'></ins><ul id='R2Ey0'></ul><sub id='R2Ey0'></sub></form><legend id='R2Ey0'></legend><bdo id='R2Ey0'><pre id='R2Ey0'><center id='R2Ey0'></center></pre></bdo></b><th id='R2Ey0'></th></span></q></dt></tr></i><div id='R2Ey0'><tfoot id='R2Ey0'></tfoot><dl id='R2Ey0'><fieldset id='R2Ey0'></fieldset></dl></div>

      1. 如何获取推送我当前视图的上一个视图控制器

        How to get the previous viewcontroller that pushed my current view(如何获取推送我当前视图的上一个视图控制器)

            <legend id='fgeCv'><style id='fgeCv'><dir id='fgeCv'><q id='fgeCv'></q></dir></style></legend>
              <tbody id='fgeCv'></tbody>

              <i id='fgeCv'><tr id='fgeCv'><dt id='fgeCv'><q id='fgeCv'><span id='fgeCv'><b id='fgeCv'><form id='fgeCv'><ins id='fgeCv'></ins><ul id='fgeCv'></ul><sub id='fgeCv'></sub></form><legend id='fgeCv'></legend><bdo id='fgeCv'><pre id='fgeCv'><center id='fgeCv'></center></pre></bdo></b><th id='fgeCv'></th></span></q></dt></tr></i><div id='fgeCv'><tfoot id='fgeCv'></tfoot><dl id='fgeCv'><fieldset id='fgeCv'></fieldset></dl></div>
                <bdo id='fgeCv'></bdo><ul id='fgeCv'></ul>

                <tfoot id='fgeCv'></tfoot>
                1. <small id='fgeCv'></small><noframes id='fgeCv'>

                  本文介绍了如何获取推送我当前视图的上一个视图控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我的应用主页有UIButtonsbtnIncomebtnExpense.按下这个按钮会分别按下 IncomeVCExpenseVC,这是两个 UIViewControllers 通过 xib 添加了 UITabBar.tabBar 有 4 个项目.在每个选项卡项目上选择添加相同的四个视图控制器(包含 UITableViews)作为 IncomeVCExpenseVC 的子视图,例如 DailyVC,WeeklyVC,MonthlyVC,YearlyVC.(即,对于收入,有每日,每周等,对于费用也是如此)(我这样做是因为 IncomeVCExpenseVCUIButton 和一个 UIView 这对于所有选项卡都是通用的).

                  The home page of my app has UIButtons, btnIncome and btnExpense. Pressing on this buttons pushes IncomeVC and ExpenseVC respectevely,which are two UIViewControllers with UITabBar added via xib. The tabBar have 4 items. Selecting on each tab item adds same four view controllers(which contains UITableViews) as the subview of IncomeVC and ExpenseVC,like for eg, DailyVC,WeeklyVC,MonthlyVC,YearlyVC.(ie,for Income ,there is daily,weekly etc and same for Expense) (I have done like that because the IncomeVC and ExpenseVC have a UIButton and a UIView which is common for all tabs).

                  所以问题是,如果单击 btnIncome,我必须使用与收入相关的数组填充这些表格视图,反之亦然.如何从哪个 viewController 中找到我选择了不同的选项卡(我需要从我添加为 IncomeVC 和 ExpenseVC 的子视图的 4 个视图中获取它).我是否必须为收入和费用分别制作 8 个不同的视图 4?谢谢.

                  So the problem is that, if click the btnIncome I have to populate those tableviews with the arrays related to Income and vice versa for Expense. How can I find from which viewController I selected the different tabs(I need to get it from the 4 Views I added as the subview of IncomeVC and ExpenseVC). Do I have to make 8 different views 4 each for Income and expense ? Thanx.

                  推荐答案

                  如果需要访问之前的视图控制器的原因是知道要获取什么数据,我建议您改为将之前的数据提供给新的视图控制器你把它推到堆栈上.或者至少有足够的数据让视图控制器知道如何获取正确的数据,例如枚举或常量或其他东西.

                  If the reason for needing access to the previous view controller is to know what data to get, I would suggest that you instead give the new view controller the data before you push it on the stack. Or at least enough data so that the view controller know how to get the right data, e.g. a enum or constant or something.

                  这可以通过自定义初始化程序或属性来完成.看看这个博客文章的例子:"传递数据视图控制器之间"

                  This could be done with a custom initializer, or a property. Take a look at this blog post for an example: "Passing Data Between View Controllers"

                  如果您使用情节提要,您可以使用 prepareForSegue:sender 来传递正确的数据.可以在这里找到一个很好的教程:Beginning Storyboards iniOS 5 第 2 部分

                  If you are using a storyboard, you can use prepareForSegue:sender to pass the right data. A good tutorial on that can be found here: Beginning Storyboards in iOS 5 Part 2

                  这篇关于如何获取推送我当前视图的上一个视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  UINavigationController inside a UITabBarController inside a UISplitViewController presented modally on iPhone(UISplitViewController 内的 UITabBarController 内的 UINavigationController 以模态方式呈现在 iPhone 上) - IT屋-程序员软件开发技术分
                  ViewController in UINavigationController orientation change(UINavigationController 中的 ViewController 方向更改)
                  Custom back button in UINavigationController(UINavigationController 中的自定义后退按钮)
                  How to add a navigation controller programmatically in code but not as initial view controller(如何在代码中以编程方式添加导航控制器,但不作为初始视图控制器)
                  The correct way to set a light status bar text color in iOS 7 based on different ViewControllers(iOS 7中基于不同ViewControllers设置灯光状态栏文字颜色的正确方法)
                  View being blocked by UITransitionView after being presented(呈现后被 UITransitionView 阻止的视图)
                      <tbody id='VMLhn'></tbody>
                  • <tfoot id='VMLhn'></tfoot>

                    <i id='VMLhn'><tr id='VMLhn'><dt id='VMLhn'><q id='VMLhn'><span id='VMLhn'><b id='VMLhn'><form id='VMLhn'><ins id='VMLhn'></ins><ul id='VMLhn'></ul><sub id='VMLhn'></sub></form><legend id='VMLhn'></legend><bdo id='VMLhn'><pre id='VMLhn'><center id='VMLhn'></center></pre></bdo></b><th id='VMLhn'></th></span></q></dt></tr></i><div id='VMLhn'><tfoot id='VMLhn'></tfoot><dl id='VMLhn'><fieldset id='VMLhn'></fieldset></dl></div>
                      <bdo id='VMLhn'></bdo><ul id='VMLhn'></ul>

                    • <small id='VMLhn'></small><noframes id='VMLhn'>

                            <legend id='VMLhn'><style id='VMLhn'><dir id='VMLhn'><q id='VMLhn'></q></dir></style></legend>