如何获取view的controller
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
补充:移动开发 , IOS ,