开发者

iPhone Modal View Controller seperate in ViewController

开发者 https://www.devze.com 2023-01-02 09:50 出处:网络
In my project most of my code is in my UIView subclass. In this subclass i want to call Modal View Controllers functions.

In my project most of my code is in my UIView subclass. In this subclass i want to call Modal View Controllers functions. As I understand those functions need UIViewController subclass to run and not UIView, where my code currently is. (Runtime stops at warning: 'View' may not respond to -presentModalViewController:animated:'). My question is, what is the way to keep most of my code in UIView and move only part of Modal View Controllers functions into UIViewController?

Should i somehow move only those two functions:

[self presentModalViewController:picker animated:YES];

[[picker parentViewController] dismissModalViewControllerAnimated:YES];

What is then the way to call them in UIViewController from my UIView?

开发者_StackOverflow社区

tnx


If I understand your question Miha you need to have everything in your view controller, not in the view itself. The view controller "controls" what views are shown.

0

精彩评论

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