开发者

UITabBarController and access commonly-used functions via protocol

开发者 https://www.devze.com 2023-01-23 01:04 出处:网络
I always use UIViewController(As RootViewController) to switch the view of 3 different UIViewControllers.

I always use UIViewController(As RootViewController) to switch the view of 3 different UIViewControllers. There are some commonly-used functions in the RootViewController. I setup the protocol for the 3 different UIViewControllers to access.开发者_运维百科 The actual function body codes are in RootViewController.m If I want to call these function, I just need to write codes below in anyone of 3 UIViewController to call the function 'aFunction' in RootViewController.m

[myDelegate aFunction];

Now, I hope to use UITabBarController(As RootController) to switch the view of 3 different UIViewControllers. I still hope to keep the mode above that store the commonly-used functions in the place where all 3 UIViewControllers can access via protocol.

Where do these function codes need to be writen to?

I can not find out the source codes body for UITabBarController. (RootViewController has the codes body RootViewController.m)

Welcome any comment

Thanks

interdev


Create a subclass of UITabBarController and put the methods in there.

0

精彩评论

暂无评论...
验证码 换一张
取 消