cordova项目多个原生界面间过场动画配置
来源:互联网 发布:会计网络继续教育东奥 编辑:程序博客网 时间:2024/06/11 20:40
本人ios小白,最近做混生开发(cordova + ionic + angularjs),由于对ios机制完全不理解,只能遇见一个问题解决一个问题了。项目需要打开外部网页,但是某条的网址有判断,不允许外部html引用,所以只能硬着头皮写原生界面来通过webview展示了(原生界面产生的原因)。在网上看到要设置过场动画需要UINavigationController这么个东西,可是cordova生成的OC代码并没有(也可能是没有找到,说了我是小白),各种尝试后,终于实现了。
AppDelegate
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions{// 这里是原来cordova生成的代码吧,改了好久了,记不清楚了 // self.viewController = [[MainViewController alloc] init]; self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window.backgroundColor = [UIColor whiteColor]; MainViewController *root = [[MainViewController alloc]init]; UINavigationController *nav =[[UINavigationControlleralloc]initWithRootViewController:root];//先将root添加在navigation上 [nav setNavigationBarHidden:YES]; [self.window setRootViewController:nav];//navigation加在window上 // 侧滑返回 nav.interactivePopGestureRecognizer.enabled = YES; nav.interactivePopGestureRecognizer.delegate =(id)self; [self.window makeKeyAndVisible]; return YES;}
上面应该就是构造了一个UINavigationController。在使用的时候,大概就是取到当前的根视图吧。
UINavigationController *result = nil; UIWindow * window = [[UIApplication sharedApplication] keyWindow]; if (window.windowLevel != UIWindowLevelNormal) { NSArray *windows = [[UIApplication sharedApplication] windows]; for(UIWindow * tmpWin in windows) { if (tmpWin.windowLevel == UIWindowLevelNormal) { window = tmpWin; break; } } } UIView *frontView = [[window subviews] objectAtIndex:0]; id nextResponder = [frontView nextResponder]; if ([nextResponder isKindOfClass:[UIViewController class]]) result = nextResponder; else result = (UINavigationController*)window.rootViewController; // 将要展示的页面push进去 即可 EvidenceDetailViewController *edv = [[EvidenceDetailViewController alloc]init]; [result pushViewController:edv animated:YES];
最开始是没有做侧滑返回的,今天需求提出来了,又和这块打交道了,就整理了下。侧滑返回参考文章:http://blog.sina.com.cn/s/blog_65c178a80102v0f4.html
0 0
- cordova项目多个原生界面间过场动画配置
- 安卓中一些界面过场动画的实现
- iOS原生项目嵌入Cordova
- activity 过场动画
- iOS 自定义过场动画
- 自定义 Android 过场动画
- ios addSubView 过场动画
- ActivityOptions过场动画
- iOS原生项目集成Cordova混合开发
- 给view添加过场动画
- 冰火围城过场动画
- iOS过场动画调研笔记
- activitiy切换的过场动画
- android 过场动画如何加载
- Android笔记 Activity过场动画
- Activity过场动画的设置
- PhoneGap/Cordova学习笔记--2.第一个Cordova项目HelloWord
- Cordova入门篇:(一) IDEA+Cordova运行第一个项目
- spring mvc与mybatis事务整合
- app调用另外一个app启动需要info.plist中设置如下,例如app调用高德地图,百度地图进行导航(详细教程)
- 带有自动提醒功能的记事本,实现开机自启动、进程常驻
- 数据库的事务隔离机制
- java设计模式系列之观察者模式
- cordova项目多个原生界面间过场动画配置
- 百宝云注册码自动发卡流程
- @available 和 #available
- 如何优化JAVA代码及提高执行效率
- Service
- 欧拉工程第1题 找出1000以下自然数中3和5的倍数之和
- android Dialog
- HTTP 方法:GET 对比 POST
- IntentService