怎么得到一个view 所在的ios view中加载控制器器

iOS通过view找到view所在的控制器
在项目中用到了这个功能,在网上找到的代码,现在贴出来(有时,我们常自定义UIView,点击view上的某个控件比如按钮,需要push到下个界面,view又没有- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)这个方法,又不想发通知,设置代理等,这个方法就派上用场了)- 代码如下```#pragma mark - 找到当前view所在的控制器- (UIViewController *)findViewController:(UIView *)sourceView{id target=sourceVwhile (target) { target = ((UIResponder *)target).nextR if ([target isKindOfClass:[UIViewController class]]) { }}}```-这里是原博客的地址,链接如下 [原博客链接地址在这里,请点击我](/maxfong/p/3423633.html)
最新教程周点击榜
微信扫一扫IOS开发:RootViewController是什么,还有个MainViewController等视图控制器。_百度知道The page is temporarily unavailable
nginx error!
The page you are looking for is temporarily unavailable.
Please try again later.
Website Administrator
Something has triggered an error on your
This is the default error page for
nginx that is distributed with
It is located
/usr/share/nginx/html/50x.html
You should customize this error page for your own
site or edit the error_page directive in
the nginx configuration file
/etc/nginx/nginx.conf.The page is temporarily unavailable
nginx error!
The page you are looking for is temporarily unavailable.
Please try again later.
Website Administrator
Something has triggered an error on your
This is the default error page for
nginx that is distributed with
It is located
/usr/share/nginx/html/50x.html
You should customize this error page for your own
site or edit the error_page directive in
the nginx configuration file
/etc/nginx/nginx.conf.

我要回帖

更多关于 控制器view的生命周期 的文章

 

随机推荐