如何获取view的controller
来源:未知 责任编辑:智问网络 发表时间:2013-10-07 00:58 点击:次
Java代码
1. [b]如何获取view的controller[/b]
2.
3. //获取view的controller
4. - (UIViewController *)viewController {
5. for (UIView* next = [self superview]; next; next = next.superview) {
6. UIResponder *nextResponder = [next nextResponder];
7. if ([nextResponder isKindOfClass:[UIViewController class]]) {
8. return (UIViewController *)nextResponder;
9. }
10. }
11. return nil;
12. }
13. //点击提交按钮
14. -(void)buttonPress{
15.
16. ElectronFrom *electronForm=[[ElectronFrom alloc]init];
17. [[self viewController].navigationController pushViewController:electronForm animated:YES];
18. [electronForm release];
19.
20. }
摘自 lanluo
相关新闻>>
- 发表评论
-
- 最新评论 更多>>