判断是否是 首次 进入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中展示的. ...
随机推荐
- USACO 5.4 Telecowmunication(最大流+枚举)
面对最小割之类的题目,完全木想法... 枚举+最大流..复杂度很大了...居然很快的就过了.. /* ID: cuizhe LANG: C++ TASK: telecow */ #include &l ...
- CentoS 下报的 Requires: perl(:MODULE_COMPAT_5.8.8)
yum error requires: libtcmalloc.so.4 rpm -Uvh http://ceph.com/rpm-cuttlefish/el6/x86_64/ceph-release ...
- iOS Json转换模型库:YYModel
iOS Json转换模型库:YYModel 其实在研究这个库之前,市面上已经有很多类似的模型序列化成JSON及反序列化库(如Mantle.MJExtension)了,推荐他只是因为他高端的性能和容 ...
- [FollowUp] Combinations 组合项
这是Combinations 组合项 的延伸,在这里,我们允许不同的顺序出现,那么新的题目要求如下: Given two integers n and k, return all possible c ...
- Notepad++ Shortcuts 快捷键
Ctrl-C Copy Ctrl-X Cut Ctrl-V Paste Ctrl-Z Undo Ctrl-Y Redo Ctrl-A Select All Ctrl-F L ...
- QGrphicsView, QGraphicsScene 和 QGraphicsItem 的区别
初学Qt的人会经常搞不清这三个图像类QGrphicsView, QGraphicsScene 和 QGraphicsItem,它们到底有什么区别呢? QGrphicsView类实际上是为QGraphi ...
- Odoo Entypo Regular Icon List
参考地址: http://www.fontslog.com/entypo-regular-otf-33800.htm#custompreview 或 http://www.w3cplus.com/w3 ...
- 二、saltstack基础配置
super65 master 192.168.1.65 super66 minion 192.168.1.66 主配置文件: [root@super65 ~]# ll /etc/sa ...
- php读取3389脚本
<?php $regkey = 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Td ...
- IOS第四天(4:下一题和选框的实现)
#import "HMViewController.h" #import "HMQuestion.h" #define kButtonWidth 35 #def ...