1,如何检测应用是第一次登陆启动
2,新手引导视图控制器我们使用UIScrollView
3,为适应不同分辨率,需要设计几套不同尺寸的图
iOS图片资源的命名规则是:
basename + screen size modifier + urischeme + orientation + scale + device + .ext
basename:文件名
screen size modifier:屏幕尺寸修饰符(iPhone5出现后才有,如 -568h)
urischeme:标识URI方案的字符串(一般情况不需要关心)
orientation:屏幕方向(横屏为-Landscape,竖屏为-Portrait)
scale:缩放尺寸(普通屏不需要,Retina屏为@2x,iPhone6后多了个@3x)
device:设备类型(~ipad表示供iPad使用)
.ext:文件扩展名(可以是png或其他格式)
4,效果图如下:
5,文件结构如下:
6,入口类:AppDelegate.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
@UIApplicationMain
class
AppDelegate
:
UIResponder
,
UIApplicationDelegate
{
var
window:
UIWindow
?
func
application(application:
UIApplication
ottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.5em!important; margin:0px!important; overflow:visible!important; padding:1px 0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,
didFinishLaunchingWithOptions launchOptions: [
NSObject
:
AnyObject
]?) ->
Bool
{
// Override point for customization after application launch.
//增加标识,用于判断是否是第一次启动应用...
if
(!(
NSUserDefaults
.standardUserDefaults().boolForKey(
"everLaunched"
))) {
.standardUserDefaults().setBool(
true
ottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.5em!important; margin:0px!important; overflow:visible!important; padding:1px 0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,forKey:
)
guideViewController =
GuideViewController
()
self
.window!.rootViewController=guideViewController;
println
(
"guideview launched!"
)
}
return
true
}
applicationWillResignActive(application:
) {
}
applicationDidEnterBackground(application:
) {
}
applicationWillEnterForeground(application:
) {
}
applicationDidBecomeActive(application:
) {
}
applicationWillTerminate(application:
) {
}
}
|
7,向导页面:GuideViewController.swift
UIViewController
uiscrollviewdelegate
numOfPages = 3
override
viewDidLoad()
{
frame =
.view.bounds
//scrollView的初始化
scrollView=
UIScrollView
()
scrollView.frame=
.view.bounds
scrollView.delegate =
self
scrollView.contentSize=
CGSizeMake
(frame.size.width*
CGFloat
(numOfPages),frame.size.height)
"\(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{
imgfile =
"jianjie\(Int(i+1)).png"
(imgfile)
image =
UIImage
(named:
"\(imgfile)"
)
imgView =
UIImageView
(image: image)
imgView.frame=
CGRectMake
(i),monospace!important; min-height:inherit!important">(0),
frame.size.width,frame.size.height)
scrollView.addSubview(imgView)
}
scrollView.contentOffset =
CGPointZero
.view.addSubview(scrollView)
}
scrollViewDidScroll(scrollView:
!)
{
"scrolled:\(scrollView.contentOffset)"
)
twidth =
(numOfPages-1) *
.view.bounds.size.width
(scrollView.contentOffset.x > twidth)
{
mainStoryboard =
UIStoryboard
(name:
"Main"
ottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.5em!important; margin:0px!important; overflow:visible!important; padding:1px 0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,bundle:
nil
)
viewController = mainStoryboard.instantiateInitialViewController()
as
UIViewController
.presentViewController(viewController,animated:
ottom:auto!important; float:none!important; height:auto!important; left:auto!important; line-height:1.5em!important; margin:0px!important; overflow:visible!important; padding:1px 0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,completion:
)
}
}
相关文章软件简介:蓝湖辅助工具,减少移动端开发中控件属性的复制和粘...
现实生活中,我们听到的声音都是时间连续的,我们称为这种信...
前言最近在B站上看到一个漂亮的仙女姐姐跳舞视频,循环看了亿...
【Android App】实战项目之仿抖音的短视频分享App(附源码和...
前言这一篇博客应该是我花时间最多的一次了,从2022年1月底至...
因为我既对接过session、cookie,也对接过JWT,今年因为工作...
|