首页 \ 问答 \ Swift中的自定义/常用工具栏(Custom/common toolbar in Swift)

Swift中的自定义/常用工具栏(Custom/common toolbar in Swift)

我对Swift很新,我正在开发一个我不确定如何设置导航的应用程序。 它适用于标签栏,但我希望条形图显示正在显示的视图。 用户应始终能够访问4个“主要”视图。 当我进入其中一个主要观点的子视图时,问题就来了。

我有标签栏,主视图有4个图标。 它目前正在显示“活动列表”。 当用户单击某个活动时,它将在下一个详细级别显示一个列表。 但是,该视图不是标签栏中显示的主要视图之一,因此它没有标签栏,也无法直接转换到其中一个主视图。 您必须先退回到“活动”列表,然后才能选择其他选项卡。

假设主视图(在标签栏中表示)是A,B,C和D.我希望能够在所有子视图上显示相同的工具栏(例如C-1,C-2等)并允许直接转换到任何其他主视图,而无需用户手动退出每个子视图。

实现这一目标的“最佳”方法是什么? 1)我应该创建一个在每个视图控制器上实现的自定义工具栏对象吗? 2)它应该是标签栏和工具栏的组合吗? 3)如果我已经钻进了一堆视图,在切换到不同的选项卡之前,是否需要单独弹出所有这些视图? 4)我用什么作为“根”视图?

谢谢你的任何建议。 我已经找到了,但还没有找到一个像这样的场景的例子。


I'm quite new to Swift and am working on an app where I'm not sure how to setup the navigation. It works with a tab bar, except that I want the bar to display nomatter what view is being displayed. There are 4 "main" views that the user should always be able to get to. The problem comes when I get into subviews of one of those main views.

I have the tab bar with the 4 icons for the primary views. It's currently displaying the "activity list". When the user clicks on an activity, it will display a list at the next level of detail. However, that view is not one of the primary ones that is represented in the tab bar, so it has no tab bar and no way to transition directly to one of the primary views. You have to back your way out to the Activity list before you can select a different tab.

Say that the main views (represented in the tab bar) are A, B, C, and D. I want to be able to display the same toolbar on all sub-views (e.g. C-1, C-2, etc.) and allow direct transition to any of the other main views, without the user having to manually back out of each sub-view.

What is the "best" way to accomplish this? 1) Should I be creating a custom toolbar object that gets implemented on every view controller? 2) Should it be a combination of tab bar and tool bars? 3) If I have drilled into a stack of views, do I need to pop all of those views individually before I can switch to a different tab? 4) What do I use as my "root" view?

Thanks for any suggestions. I have hunted, but haven't found an example of a scenario quite like this.


原文:https://stackoverflow.com/questions/28800687
更新时间:2023-09-06 14:09

最满意答案

一些基本的事情要尝试,

  • 确保您首先构建代码。
  • 确保你在[TestMethod]内
  • 检查班级的顶部是否有[CodedUITest]
  • 您是否正在使用所有引用(例如,使用Microsoft.VisualStudio.TestTools.UITesting)

如果它不起作用,请告诉我并尝试获取更多信息。


A few basic things to try,

  • Make Sure you build the code first.
  • Make sure you are within a [TestMethod]
  • Check that the top of your class has [CodedUITest]
  • Are you using all your references (eg. using Microsoft.VisualStudio.TestTools.UITesting)

Let me know if it doesn't work and try and get more info.

相关问答

更多

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。