简体   繁体   中英

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.

So when the user clicks on the menu, a sliding menu pops out by means of a 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 .

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.

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.

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 . Then pass the UITableView of class B as a parameter to the new constructor of the main class . Then you can work with it from there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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