判断是否是 首次 进入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中展示的. ...
随机推荐
- linux安装apache的纠结过程
本以为linux下安装apache是件很简单的过程.三命令就可以搞定,jxvf解压,make 编译,make install 安装就OK了.没想到这个过程还颇费周折.可能和环境有关吧.先说一下我的环境 ...
- fork和execve
fork函数在新的子进程中运行相同的程序,新的子进程是父进程的一个复制品. execve函数在当前进程的上下文中加载并运行一个新的程序.它会覆盖当前进程的地址空间,但并没有创建一个新的进程.新的程序仍 ...
- 【BZOJ】1854: [Scoi2010]游戏
http://www.lydsy.com/JudgeOnline/problem.php?id=1854 题意:n个数据,每个数据有两个属性,要求取一些数据且每个数据取一个属性使得组成连续的一段单调递 ...
- android开发 BaseAdapter中getView()里的3个参数是什么意思
BaseAdapter适配器里有个getView()需要重写public View getView(int position,View converView,ViewGroup parent){ // ...
- MatLab GUI Change Size 改变界面大小
在MatLab做的GUI界面,我们有时候会希望界面的大小能改变,并且上面的控件也会跟着界面变大或者缩小,MatLab在这方面做的非常好,不像Qt的GUI那样实现起来那么麻烦,只需要把界面的属性Resi ...
- Asp反向代理程序,调用远程站点全站数据,一款脚本级反向代理程序.
前些天临时写的一脚本级反向代理程序,用法很简单,设置好目标站地址,然后放到你网站根目录:index.asp,再将404页面自定义为:index.asp,即可. 由于暂时没有 url 替换需要,所以没有 ...
- appSetting 在单独文件的读写
#region appSetting /// <summary> /// 设定 appSetting /// </summary> /// <param name=&qu ...
- ci调用application/views下的css,js,图片资源出现You don't have permission to access CodeIgniter on this server解决
原因是view文件下面有个.htaccess文件,里面写的是 Deny from all //拒绝所有请求 自己本地测试的话,就直接去掉,放到服务器就指定application/views文件 ...
- mysql null值的特殊处理
实例 尝试以下实例: root@host# mysql -u root -p password; Enter password:******* mysql> use RUNOOB; Databa ...
- 【Fate/kaleid liner 魔法少女☆伊莉雅】系列中实践的、新世代的动画摄影工作流
通常的日本动画的摄影中,是以追加Cell(celluloid 赛璐珞)与背景的合成滤镜处理为主,而在[Fate/kaleid liner 魔法少女☆伊莉雅]系列的,加入了自己使用3DCG软 ...