Swift - 启动时的向导页(新手引导)的制作


|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
import UIKit@UIApplicationMainclass AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. //增加标识,用于判断是否是第一次启动应用... if (!(NSUserDefaults.standardUserDefaults().boolForKey("everLaunched"))) { NSUserDefaults.standardUserDefaults().setBool(true, forKey:"everLaunched") var guideViewController = GuideViewController() self.window!.rootViewController=guideViewController; println("guideview launched!") } return true } func applicationWillResignActive(application: UIApplication) { } func applicationDidEnterBackground(application: UIApplication) { } func applicationWillEnterForeground(application: UIApplication) { } func applicationDidBecomeActive(application: UIApplication) { } func applicationWillTerminate(application: UIApplication) { }} |
7,向导页面:GuideViewController.swift
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
import UIKitclass GuideViewController:UIViewController,UIScrollViewDelegate{ var numOfPages = 3 override func viewDidLoad() { var frame = self.view.bounds //scrollView的初始化 var scrollView=UIScrollView() scrollView.frame=self.view.bounds scrollView.delegate = self //为了能让内容横向滚动,设置横向内容宽度为3个页面的宽度总和 scrollView.contentSize=CGSizeMake(frame.size.width*CGFloat(numOfPages),frame.size.height) println("\(frame.size.width*CGFloat(numOfPages)),\(frame.size.height)") scrollView.pagingEnabled=true scrollView.showsHorizontalScrollIndicator=false scrollView.showsVerticalScrollIndicator=false scrollView.scrollsToTop=false for i in 0..<numOfPages{ var imgfile = "jianjie\(Int(i+1)).png" println(imgfile) var image = UIImage(named:"\(imgfile)") var imgView = UIImageView(image: image) imgView.frame=CGRectMake(frame.size.width*CGFloat(i),CGFloat(0), frame.size.width,frame.size.height) scrollView.addSubview(imgView) } scrollView.contentOffset = CGPointZero self.view.addSubview(scrollView) } func scrollViewDidScroll(scrollView: UIScrollView!) { println("scrolled:\(scrollView.contentOffset)") var twidth = CGFloat(numOfPages-1) * self.view.bounds.size.width if(scrollView.contentOffset.x > twidth) { var mainStoryboard = UIStoryboard(name:"Main", bundle:nil) var viewController = mainStoryboard.instantiateInitialViewController() as UIViewController self.presentViewController(viewController, animated: true, completion:nil) } }} |
Swift - 启动时的向导页(新手引导)的制作的更多相关文章
- android应用程序第一次启动时显示引导界面
市面上好多优秀的应用(举例新浪微博.UC浏览器)都采用了欢迎页面与使用向导的方式给用户带来了良好的用户体验. 一般来说用户第一次安装应用或者安装了新版本后第一次进入应用都会显示成 欢迎页面-使用向导- ...
- 【Android端 APP 启动时长获取】启动时长获取方案及具体实施
一.什么是启动时长? 1.启动时长一般包括三种场景,分别是:新装包的首次启动时长,冷启动时长.热启动时长 冷启动 和 热启动 : (1)冷启动:当启动应用时,后台没有该程序的进程,此时启动的话系统会分 ...
- Sharepoint 2010 工作流启动时处理表单出错
问题: Shareoint 2010 列表工作流启动时,显示“处理表单时出现严重错误”. Error Message-1: Object doesn't support property or met ...
- Crystal Reports 2008(水晶报表) 启动时检查更新
在安装好了Crystal Reports后,每次打开的是都会出现以下提示: 服务器正在运行中 由于另一个程序正在运行中,此操作无法完成.请选择“切换到”来激活正在运行中的程序,并更正问题. 碰到这样的 ...
- MySQL指定mysqld启动时所加载的配置文件
mysqld.exe --init-file=file_name 以下为配置文件参数优化和中文详解: [client]port = 3306socket = /tmp/mysql.sock [mysq ...
- intellj(idea) 编译项目时在warnings 页签框里 报 “xxx包不存在” 或 “找不到符号” 或 “未结束的字符串字面值” 或 “需要)” 或 “需要;”等错误提示
如上图: 环境 是 刚换的系统,重装的Intellj,直接双击老的皇帝项目中的idea的 .iml文件,结果 打开 intellj 后,进行 ctrl +shift +F9 编译时 尽然报 错误提示, ...
- iOS 界面启动时,功能新特征显示
APP新启动的时候,都会有几张新的图片滑动,才能到主的界面.现在,我们新建一个控制器,专门来处理新特性,直接上代码. 第一步:新建一个NewfeatureController // // HWNewf ...
- Redis 3.0版本启动时出现警告的解决办法
原文:http://m.blog.csdn.net/article/details?id=50864933 Redis 3.0.7版本启动时出现警告的解决办法 发表于2016/3/12 12:52:4 ...
- Linux系统开机启动时的工作原理
Linux系统开机启动时的工作原理也是深入了解Linux系统核心工作原理的一个很好的途径. 启动第一步--加载BIOS 当你打开计算机电源,计算机会首先加载BIOS信息,BIOS信息是如此的重要,以至 ...
随机推荐
- 感觉Release有时比Debug要健壮
评估文件夹大小的时候,直接跨线程操作UI界面,Debug崩溃,Release不崩溃. 更多的一种情况是,本机DEBUG下不崩溃,把RELEASE版本到别的机子上,立刻崩溃(登录框的进度条的对象为空,仍 ...
- Python标准库:内置函数repr(object)
本函数是返回对象object的具体说明字符串. 样例: #repr() print(repr(range(5))) print(repr(help)) print(repr(0x200)) print ...
- python下载文件(图片)源码,包含爬网内容(爬url),可保存cookie
#coding=utf-8 ''' Created on 2013-7-17 @author: zinan.zhang ''' import re import time import httplib ...
- HDU--杭电--1501--Zipper--深搜、DP都好
Zipper Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Sub ...
- java--内部类实现“类的多重继承”
class Fa1{ private int k = 1; void show() { System.out.println(k); } } class Fa2{ private int k = 10 ...
- 网站实战 从效果图开始CSS+DIV 布局华为网站
经过我们的前面css的学习,我们已经分模块的掌握的CSS的技术,但是,要是完整的做一个页面,我们还没有接触过,这次呢,小强老师来和大家完整的利用CSS+DIV做一个网站案例,我们来模仿下华为的网站. ...
- CString Format 乱码问题
CString m_buf;CStatic *m_static;char *szName;...m_buf.Format(":%s",szName);m_static->Se ...
- 如何使用不同dll的相同namespace下的相同接口
问题: 程序里加载了2个dll,这2个dll里都声明了同样的命名空间(这个不违法),然后在这个同样的命名空间下,他俩又定义了同名的interface. 然后我程序里直接using这个命名空间,使用这个 ...
- paip.按键替换映射总结
paip.按键替换映射总结 作者Attilax , EMAIL:1466519819@qq.com 来源:attilax的专栏 地址:http://blog.csdn.net/attilax 因为 ...
- 73_leetcode_Construct Binary Tree from Inorder and Postorder Traversal
Given inorder and postorder traversal of a tree, construct the binary tree 1:中序和后序遍历构成一棵树.2:採用递归的方法. ...