1:如何在view里面,实现控制器controller的跳转
在开发的公共类里面写这个方法,在view的需要跳转的点击事件调用即可。
/**
* 利用响应链实现view里面直接跳转ViewControlller
*
* @param pushView 跳转的视图
* @param pushViewController 跳转到的控制器
*/
+ (void)pushView:(UIView *)pushView pushViewController:(__kindof UIViewController *)pushViewController {
UIResponder * next = [pushView nextResponder];
while (next != nil) {
if ([next isKindOfClass:UINavigationController.class]) {
//找到了Nav,实现跳转
[((UINavigationController *)next) pushViewController:pushViewController animated:YES];
}
next = [next nextResponder];//没有找到next等于下一个响应者
}
}
2:如何在vie

本文探讨了在iOS开发中如何实现在View内触发Controller的跳转。通过在公共类中定义方法并在视图点击事件中调用,可以实现控制器的跳转。此外,还介绍了如何在View中利用响应链找到并调用对应Controller的方法,以便执行特定操作。
最低0.47元/天 解锁文章
1678

被折叠的 条评论
为什么被折叠?



