[英]How to set a hidden property on a view controller in Xamarin iOS once it has been set by another class with a CA Transition
I have a UI ViewController
that has a UITableView
controller embedded in it by means of a Container View
and an Embed
segue. 我有一个UI ViewController
,其中有一个通过Container View
和Embed
segue Embed
的UITableView
控制器。
So when the user clicks on the menu, a sliding menu pops out by means of a CATransition
. 因此,当用户单击菜单时,将通过CATransition
弹出滑动菜单。 On this menu, one of the options is "Home" that moves the menu back to it's original position and sets the Hidden property of this TableView Controller
to true
. 在此菜单上,选项之一是“主页”,它将菜单移回其原始位置并将此TableView Controller
的Hidden属性设置为true
。
The next time you click on the Menu button, the menu does not pop out because the TableView Controller
's Hidden
property was set to True
in it's class when we clicked on the Home
button. 下次单击菜单按钮时,菜单不会弹出,因为当我们单击“ Home
按钮时, TableView Controller
“ Hidden
属性在其类中被设置为True
。
Summary Thus the problem is that once the user clicks on the Menu
button, the current class needs to be able to set the hidden property of a TableView
controller that is defined in another class. 结束语因此,问题在于,一旦用户单击“ Menu
按钮,当前类就需要能够设置在另一个类中定义的TableView
控制器的hidden属性。
I guess this is more to do with interaction between classes than mobile development, but I included the whole scenario as background. 我想这更多是与类之间的交互有关,而不是与移动开发有关,但是我将整个场景作为背景。
What is the best practice way of achieving this? 实现此目标的最佳做法是什么?
Create an additional constructor in the main class that excepts a parameter
of type UITableView
. 在主类中创建一个除了UITableView
类型的parameter
之外的其他构造函数。 Then pass the UITableView
of class
B as a parameter
to the new constructor
of the main class
. 然后将B class
的UITableView
作为parameter
传递给主class
的新constructor
。 Then you can work with it from there. 然后,您可以从那里开始使用它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.