简体   繁体   English

如何在按钮上单击以打开uitabbaritem上的新视图控制器

[英]How to open new view controller on uitabbaritem on button click

I am working on uitabbarcontroller. 我正在使用uitabbarcontroller。 When i click on one tabbaritem at that time i am place two button at the top of view and want to open different view on button click, i don't want to move to another view, the uitabbaritem at the bottom should be remaining the same. 当我当时单击一个标签栏时,我在视图顶部放置了两个按钮,并希望在按钮单击时打开不同的视图,我不想移至另一视图,底部的uitabbaritem应该保持不变。

请看这张图片

here i want to open different view on Company profile and My profile . 在这里,我想在“ 公司资料”和“ 我的资料”中打开不同的视图。

请检查我的情节提要的结构

how can i add scrollview with containor view. 我如何添加带有容器视图的scrollview。 i am using this structure in below image 我在下图中使用此结构

这是我使用的结构,我需要在容器视图的嵌入式视图中添加更多内容

Since you are creating the two buttons programatically, you can also create the view programatically when the button is clicked. 由于要以编程方式创建两个按钮,因此单击按钮时也可以以编程方式创建视图。

Use the button's addTarget Method to create the views and add them to the viewcontroller. 使用按钮的addTarget方法创建视图并将其添加到viewcontroller中。

I think in your case, it would be better to create a new viewcontroller and present it modally, instead of creating a view and adding it. 我认为在您的情况下,最好创建一个新的viewcontroller并以模态呈现,而不是创建一个视图并添加它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM