我的解决方案:...

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之后前导页的设置的更多相关文章

  1. iOS 10 的坑:新机首次安装 app,请求网络权限“是否允许使用数据”(转)

    症状 iOS 10 之后,陆陆续续地有用户联系我们,说新机第一次安装.第一次启动的时候,app 首屏一片空白,完全没数据.kill 掉重新打开就好了. 一开始以为是用户网络情况不好,但随着越来越多的用 ...

  2. 首次发布App,In-App Purchase 无法submit for review 问题的解决方案

    原地址:http://blog.csdn.net/blucenong/article/details/7819195 一个IDP首次create app 然后首次create new IAP的时候,我 ...

  3. 判断是苹果还是安卓app联调

    //app苹果联调 function iosReload(){ //window.webkit.messageHandlers.signUpSuccess.postMessage(null); } / ...

  4. android 判断程序是首次(第一次)进入

    很多时候,我们需要判断用户是不是第一次进入程序,以决定是不是给用户一些操作提示. 这种功能的实现,说到底还是将数据(一个标志位)存储起来,下次进入程序的时候读取数据进行判断. 我这里只给出一种较简单的 ...

  5. HTML中判断手机是否安装某APP,跳转或下载该应用

    有些时候在做前端输出的时候,需要和app的做些对接工作.就是在手机浏览器中下载某app时,能判断该用户是否安装了该应用.如果安装了该应用,就直接打开该应用:如果没有安装该应用,就下载该应用.那么下面就 ...

  6. js判断是否安装某个android app,没有安装下载该应用(websocket通信,监听窗口失去焦点事件)

    现在经常有写场景需要提示用户下载app, 但是如果用户已经安装,我们希望是直接打开app. 实际上,js是没有判断app是否已经安装的方法的,我们只能曲线救国. 首先,我们需要有call起app的sc ...

  7. iOS 之 判断是否是第一次打开app

    /** App判断第一次启动的方法 */ NSString *key = @"isFirst"; BOOL isFirst = [[NSUserDefaults standardU ...

  8. js判断设备,跳转app应用、android市场或者AppStore

    js移动设备判断方法大全 <!DOCTYPE html> <html> <head> <meta charset="UTF-8" > ...

  9. APP发布Xcode7

    一.准备工作 1>准备3.5寸.4寸.4.7寸.5.5寸的程序截图至少个1张,如果支持iPad,那么iPad截图也要有.这些截图尽量截取页面漂亮的,因为这些截图是要放在AppStore中展示的. ...

随机推荐

  1. 【原】storm源码之理解Storm中Worker、Executor、Task关系

    Storm在集群上运行一个Topology时,主要通过以下3个实体来完成Topology的执行工作:1. Worker(进程)2. Executor(线程)3. Task 下图简要描述了这3者之间的关 ...

  2. [二分图&最小割]

    OTL@assassain 反转源汇的模型: 给定一个二分图,同时选择集合中的两个点会有一个代价,选择每一个点有一个收益,问最大收益是多少 (即两个点在不同的集合中是有冲突关系的) 解法: 用最小割模 ...

  3. UOJ#61. 【UR #5】怎样更有力气

    大力水手问禅师:“大师,很多事情都需要用很大力气才能完成,而我在吃了菠菜之后力气很大,于是就导致我现在非常依赖菠菜.我很讨厌我的现状,有没有办法少吃点菠菜甚至不吃菠菜却仍很有力气?” 禅师浅笑,答:“ ...

  4. e.KeyChar用到的键盘对应ASCII码值(转)

    十进制编码 (对应)缩写字符(或功能/解释)   0 NUL(null) 空字符   1 SOH(start of headline) 标题开始   2 STX (start of text) 正文开 ...

  5. UIWebView弹出键盘按钮显示中文

    UIWebView是一个很常用的视图,一般用来加载网页,比如百度: 点击文本框输入框后,会弹出一个带有toolbar的键盘,toolbar中有3个辅助按钮 有了这3个按钮,是方便很多,但默认是英文的, ...

  6. 4.用文本编辑器输入课堂上练习的Hello.java,并在JDK环境下编译和运行。请将程序编译、运行的结果截图,填入下框中。

    一开始报错是因为在文本框了的:用的是中文下的,应该用英文下的;

  7. state配置语言实战

    修改配置文件:(base用来放初始化环境.prod用来放生产配置环境) [root@super65 ~]# vim /etc/salt/master [root@super65 ~]# mkdir - ...

  8. 【IOS笔记】View Controller Basics

    View Controller Basics   视图控制器基础 Apps running on iOS–based devices have a limited amount of screen s ...

  9. 学习之道-从求和起-求和曲线面积瞬时速率极限微积分---求和由高解低已知到未知高阶到低阶连续自然数的K次方之和

    数学分析 张筑生

  10. Linguistic corpora 种子语料库-待分析对象-分析与更新语料库

    Computational Linguistics http://matplotlib.org/ https://github.com/matplotlib/matplotlib/blob/maste ...