判断是否是 首次 进入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中展示的. ...
随机推荐
- python 根据对象和方法名,返回提供这个方法的定义的类
def find_defining_class(obj, method_name): for ty in type(obj).mro(): if method_name in ty.__dict__: ...
- cocos2d 中判断CGPoint或者CGSize是否相等
cocos2d 中判断CGPoint是否相等 调用CGPointEqualToPoint(point1, point2) 判断CGSize是否相等 调用CGSizeEqualToSize(size1, ...
- HTML5怎样在网页中使用摄像头功能
怎样在网页中使用摄像头,html5越来越多的使用到实际工作中,那么他怎样调用摄像头呢进行视频聊天,视频监控等活动呢,今天为大家抛砖引玉,教大家怎样实现怎样利用html5实现摄像头视频监控功能.废话不多 ...
- lucene 3.0.2 + 多文件夹微博数据(时间,微博)构建索引
package lia.meetlucene; import java.io.File; import java.io.IOException; import java.util.LinkedList ...
- lucene 3.0.2 search 各种各样的Query类型
http://blog.sina.com.cn/s/blog_61d2047c010195mo.html lucene的这种各种各样的查询类型 1.TermQuery 最简单的Qu ...
- ADO.NET对象之 DataTable
ADO.NET可以在与数据库断开连接的方式下通过DataSet或DataTable对象进行数据处理,当需要更新数据时才重新与数据源进行连接,并更新数据源. DataTable对象表示保存在本机内存中的 ...
- 完美洗牌&洗牌
完美洗牌问题,给定一个数组a1,a2,a3,...an,b1,b2,b3..bn,把它最终设置为b1,a1,b2,a2,...bn,an这样的. O(n)的算法,O(n)的空间. 对于前n个数,映射为 ...
- swfit-pod使用
一.查询第三方版本号 pod search SDWebImage 二.项目添加pod 1.在终端打开项目路径 2.输入 pod init 生成Podfile 三.在Podfile输入需要的第三方 ...
- Ubuntu下设置中文字符集支持(解决中文乱码问题)
一. Ubuntu默认的中文字符编码 Ubuntu默认的中文字符编码为zh_CN.UTF-8,这个可以在/etc/environment中看到: sudo gedit /etc/environment ...
- jquery选中将select下拉框中一项后赋值给text文本框
jquery选中将select下拉框中一项后赋值给text文本框,出现无法将第一个下拉框的value赋值给文本框 因为select默认选中第一项..在选择第一项时,便导致无法激发onchange事件. ...