判断是否是 首次 进入app,,以及Xcode7之后前导页的设置
我的解决方案:...
1、在appdelegate.m中找到
“application:didFinishLaunchingWithOptions:”方法, 添加以下代码:
/**
* 前导页
*/
if([[[NSUserDefaults standardUserDefaults] objectForKey:@"isExisted"]isEqualToString:@"exist"]){
[self gotoMain];
NSLog(@"222222222");
}else{
FirstLaunchViewController *firstLaunchVC = [[FirstLaunchViewController alloc]init];
self.window.rootViewController = firstLaunchVC;
NSLog(@"111111111");
}
-(void)gotoMain
{
NSLog(@"主页。。。");
[[NSUserDefaults standardUserDefaults] setObject:@"exist" forKey:@"isExisted"];
MainViewController *firstLaunchVC = [[MainViewController alloc]init];
self.window.rootViewController = firstLaunchVC;
NSLog(@"111111111");
}
总的解决办法是 key: @”isExisted” 对应的value 是不是“exist”判断用户以前是否登录,
在第一次启动的时候 key @” isExisted” 不会被赋址的, 也就是说value为nil.
2、前导页
新建FirstLaunchViewController文件,走完前导页,调用的APPDelegate.h方法进入主页界面。。。
#import "JYEFirstLaunchViewController.h"
#import "AppDelegate.h"
@interface FirstLaunchViewController ()<UIScrollViewDelegate>
{
UIPageControl * pageCtr;
BOOL isOut;//判断是否进入主页
}
@end
@implementation JYEFirstLaunchViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self gotoLaunchView];
}
-(void)gotoLaunchView
{
NSLog(@"引导页");
UIScrollView * scroll = [[UIScrollView alloc]initWithFrame:[UIScreen mainScreen].bounds];
scroll.pagingEnabled = YES;
scroll.delegate = self;
scroll.contentOffset = CGPointMake(0, 0);
scroll.contentSize = CGSizeMake(self.view.frame.size.width * 3, self.view.frame.size.height);
// scroll.bounces = NO;//让scrollView在他的自身范围内滑动//在这里添加“进入应用Button”
[self.view addSubview:scroll];
NSArray * imageArr = @[@"Default1@2x.png",@"Default2@2x.png",@"Default3@2x.png"];
for(int i = 0;i<imageArr.count;i++)
{
UIImageView * imageView = [[UIImageView alloc]initWithFrame:CGRectMake(self.view.frame.size.width * i, 0, self.view.frame.size.width, self.view.frame.size.height)];
imageView.image = [UIImage imageNamed:imageArr[i]];
[scroll addSubview:imageView];
}
pageCtr = [[UIPageControl alloc]initWithFrame:CGRectMake(50, scroll.frame.size.height - 30, scroll.frame.size.width - 100, 30)];
pageCtr.currentPage = 0;
pageCtr.numberOfPages = imageArr.count;
pageCtr.pageIndicatorTintColor = [UIColor redColor];
[self.view addSubview:pageCtr];
}
-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
if(scrollView.contentOffset.x > self.view.frame.size.width * 2)
{
//跳到主界面
isOut = YES;
}
}
-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
pageCtr.currentPage = scrollView.contentOffset.x / self.view.frame.size.width;
if(isOut)
{
[UIView animateWithDuration:0.1 animations:^{
scrollView.alpha = 0;
} completion:^(BOOL finished) {
[scrollView removeFromSuperview];
[self gotoMain1];
}];
}
}
-(void)gotoMain1{
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate gotoMain];
NSLog(@"zhuye");
}
判断是否是 首次 进入app,,以及Xcode7之后前导页的设置的更多相关文章
- iOS 10 的坑:新机首次安装 app,请求网络权限“是否允许使用数据”(转)
症状 iOS 10 之后,陆陆续续地有用户联系我们,说新机第一次安装.第一次启动的时候,app 首屏一片空白,完全没数据.kill 掉重新打开就好了. 一开始以为是用户网络情况不好,但随着越来越多的用 ...
- 首次发布App,In-App Purchase 无法submit for review 问题的解决方案
原地址:http://blog.csdn.net/blucenong/article/details/7819195 一个IDP首次create app 然后首次create new IAP的时候,我 ...
- 判断是苹果还是安卓app联调
//app苹果联调 function iosReload(){ //window.webkit.messageHandlers.signUpSuccess.postMessage(null); } / ...
- android 判断程序是首次(第一次)进入
很多时候,我们需要判断用户是不是第一次进入程序,以决定是不是给用户一些操作提示. 这种功能的实现,说到底还是将数据(一个标志位)存储起来,下次进入程序的时候读取数据进行判断. 我这里只给出一种较简单的 ...
- HTML中判断手机是否安装某APP,跳转或下载该应用
有些时候在做前端输出的时候,需要和app的做些对接工作.就是在手机浏览器中下载某app时,能判断该用户是否安装了该应用.如果安装了该应用,就直接打开该应用:如果没有安装该应用,就下载该应用.那么下面就 ...
- js判断是否安装某个android app,没有安装下载该应用(websocket通信,监听窗口失去焦点事件)
现在经常有写场景需要提示用户下载app, 但是如果用户已经安装,我们希望是直接打开app. 实际上,js是没有判断app是否已经安装的方法的,我们只能曲线救国. 首先,我们需要有call起app的sc ...
- iOS 之 判断是否是第一次打开app
/** App判断第一次启动的方法 */ NSString *key = @"isFirst"; BOOL isFirst = [[NSUserDefaults standardU ...
- js判断设备,跳转app应用、android市场或者AppStore
js移动设备判断方法大全 <!DOCTYPE html> <html> <head> <meta charset="UTF-8" > ...
- APP发布Xcode7
一.准备工作 1>准备3.5寸.4寸.4.7寸.5.5寸的程序截图至少个1张,如果支持iPad,那么iPad截图也要有.这些截图尽量截取页面漂亮的,因为这些截图是要放在AppStore中展示的. ...
随机推荐
- BZOJ3651 : 网络通信
同[ZJOI2012]网络,把每个点拆成C个点然后用LCT维护. #include<cstdio> #include<map> #define P make_pair #def ...
- 避免常见的6种HTML5错误用法
一.不要使用section作为div的替代品 人们在标签使用中最常见到的错误之一就是随意将HTML5的<section>等价于<div>——具体地说,就是直接用作替代品(用于样 ...
- 【BZOJ】3224: Tyvj 1728 普通平衡树(某不科学的oj)
http://www.lydsy.com/JudgeOnline/problem.php?id=3224 无力吐槽,无力吐槽,无力吐槽....... bzoj竟然不能用time(0)我竟然不造!!re ...
- idea_IDEA跑Tomcat异常
IDEA跑Tomcat异常 具体异常如下 Artifact :war exploded: Server is not connected. Deploy is not avail 根据别人的回答,去掉 ...
- [转] - QBuffer类参考
QBuffer类参考 QBuffer类是一个操作QByteArray的输入/输出设备. 详情请见…… #include <qbuffer.h> 继承了QIODevice. 所有成员函数的列 ...
- Scrum会议3
组名称:天天向上 项目名称:连连看 参会成员:王森(Master)张金生 张政 栾骄阳 时间:2016.10.18 已完成内容: 1.GUI布局设计 2.通过在网上大量阅览代码,大体了解连连看游戏制作 ...
- OpenCV学习笔记——形态学梯度操作
代码: #include<cv.h> #include<highgui.h> int main(void) { cvNamedWindow("cmp"); ...
- 【ZZ】 移位贴图 Displacement Mapping
http://blog.csdn.net/huazai434/article/details/5650629 说明:该技术需要VS3.0的支持!!! 一,移位贴图类似于地形渲染.不过由于移位纹理可以做 ...
- DS实验题 sights
算法与数据结构实验题 6.3 sights ★实验任务 美丽的小风姑娘打算去旅游散心,她走进了一座山,发现这座山有 n 个景点, 由于山路难修,所以施工队只修了最少条的路,来保证 n 个景点联通,娇弱 ...
- PHP 开发 APP 接口 学习笔记与总结 - APP 接口实例 [7] APP 错误日志接口
APP 上线以后可能遇到的问题: ① APP 强退 ② 数据加载失败 ③ APP 潜在问题 错误日志需要记录的内容 数据表 error_log 字段: id app_id:app 类别 id did: ...