views:

38

answers:

1

hi!

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?

tnx

+1  A: 

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.

Xcoder
Yes you're right, now i moved everything to view controller and works fine. It just seemed to me that it's better to keep my huge code separated from view controller and keep important things there. How are rest of you keeping your code organized? Are there any rules on how to organize or it doesn't metter?
Miha