- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; id key = (id)kCFBundleVersionKey; // 检测是否第一次使用这个版本 // 新浪微博-Info.plist
NSDictionary *info = [NSBundle mainBundle].infoDictionary;
// 获取当前软件的版本号
NSString *currentVersion = [info objectForKey:key]; // 从沙盒中取出版本号
NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
NSString *saveVersion = [defaults objectForKey:key]; // 不是第一次使用这个版本
if ([currentVersion isEqualToString:saveVersion]) { //MJLog(@"不是第一次使用这个版本");
// 显示状态栏
application.statusBarHidden = NO; IndexController *index = [[[IndexController alloc] init] autorelease];
self.window.rootViewController = index; } else { // 第一次使用这个版本
// 更新沙盒中的版本号
[defaults setObject:currentVersion forKey:key];
// 同步到沙盒中
[defaults synchronize]; //MJLog(@"第一次使用这个版本"); // 显示版本新特性控制器
NewFeatureController *new = [[[NewFeatureController alloc] init] autorelease];
self.window.rootViewController = new;
} [self.window makeKeyAndVisible];
return YES;
}
#define kNewFeatureListName @"new_feature"
#define kNewFeatureListExt @"plist" #import "NewFeatureController.h"
#import "IndexController.h"
#import <QuartzCore/QuartzCore.h> @interface NewFeatureController ()
@end @implementation NewFeatureController
#pragma mark - 按钮点击
- (void)start {
UIApplication *app = [UIApplication sharedApplication];
// 显示状态栏
app.statusBarHidden = NO; IndexController *index = [[IndexController alloc] init]; // 设置窗口的根控制器
app.keyWindow.rootViewController = index; [index release]; // 执行动画
CATransition *anim = [CATransition animation];
anim.duration = 0.4;
anim.type = kCATransitionPush;
anim.subtype = kCATransitionFromRight;
[app.keyWindow.layer addAnimation:anim forKey:nil];
} #pragma mark - 生命周期方法
- (void)loadView {
// 不需要调用super的loadView // self.view默认是nil的,一旦发现view是nil,就会调用loadView方法大创建view
// 这里会造成死循环
//self.view = [[UIScrollView alloc] initWithFrame:self.view.bounds]; // 控制器的view最适合的frame
CGRect appFrame = [UIScreen mainScreen].applicationFrame; // 建议少用autorelease
UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:appFrame];
self.view = scrollView;
[scrollView release];
} - (void)viewDidLoad
{
[super viewDidLoad]; // 获取new_feature.plist的路径
NSString *path = [[NSBundle mainBundle] pathForResource:kNewFeatureListName ofType:kNewFeatureListExt];
// 加载new_feature.plist
NSArray *array = [NSArray arrayWithContentsOfFile:path];
int count = array.count; // 设置scrollView的内容宽度
UIScrollView *scrollView = (UIScrollView *)self.view;
scrollView.contentSize = CGSizeMake(count * scrollView.bounds.size.width, ); // 设置分页
scrollView.pagingEnabled = YES;
// 隐藏水平的滚动条
scrollView.showsHorizontalScrollIndicator = NO;
// 去除弹簧效果
scrollView.bounces = NO; for (int index = ; index< count; index++) {
// 获取图片名称
NSString *imgName = [array objectAtIndex:index];
// 加载图片
UIImage *image = [UIImage imageNamed:imgName]; // 创建UIImageView
UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; // 设置ImageView的x
CGRect frame = imageView.frame;
frame.origin.x = index * image.size.width;
imageView.frame = frame; [self.view addSubview:imageView];
[imageView release]; // 添加"开始微博"按钮
if (index == count - ) {
// 让UIImageView跟用户进行交互(接收触摸事件)
imageView.userInteractionEnabled = YES; // 创建按钮
UIButton *btn = [[UIButton alloc] init];
btn.bounds = CGRectMake(, , , );
btn.center = CGPointMake(image.size.width * 0.5f, image.size.height - ); // 设置默认和高亮背景
[btn setNormalBg:@"new_features_startbutton_background.png" andHighlighted:@"new_features_startbutton_background_highlighted.png"]; // 设置按钮文字
NSString *title = NSLocalizedString(@"开始微博", nil);
[btn setTitle:title forState:UIControlStateNormal]; // 设置按钮文字颜色
[btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; // 设置按钮文字大小
btn.titleLabel.font = [UIFont systemFontOfSize:]; [imageView addSubview:btn]; // 监听按钮
[btn addTarget:self action:@selector(start) forControlEvents:UIControlEventTouchUpInside]; [btn release];
}
}
} @end

ios中开始页面做法的更多相关文章

  1. ios中iframe页面出现白屏问题

    最近用ionic3开发的一个项目在ios中出现了白屏的问题 banner轮播图跳转网页 使用了iframe 但是却时不时的出现白屏现象 在android中一切正常 网上查资料发现 是因为ios不允许访 ...

  2. [原]iOS中 Web 页面与 Native Code 的一种通信方式

    在 iOS 开发中,Web 页面与 Native Code 通信可以分为两个方面: 1.Native Code 调用 Web 页面的方法:主要是调用页面中的 Javascript 函数. 2.Web ...

  3. iframe ios中h5页面 样式变大

    实际项目开发中,iframe在移动设备中使用问题还是很大的,说一说我的那些iframe坑 做过的这个后台管理框架,最开始的需求是PC,但随着业务需要,需要将项目兼容到ipad,后台的框架也是使用的开源 ...

  4. iOS 中 h5 页面 iframe 调用高度自扩展问题及解决

    开发需求需要在 h5 中用 iframe 中调用一个其他公司开发的 html 页面. 简单的插入 <iframe /> 并设置宽高后,发现在 Android 手机浏览器上打开可以正常运行, ...

  5. ios中滚动页面

    - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { int width=frame. ...

  6. 阻止iOS中页面弹性回滚,只允许div.phone_body的区块有弹性

    使用说明:只要替换选择器:var selector = '.phone_body'; /** * 阻止iOS中页面弹性回滚,只允许div.scroller的区块有弹性 */ (function () ...

  7. ios系统微信浏览器、safari浏览器中h5页面上拉下滑导致悬浮层脱离窗口的解决方法

    一. 运行环境: iphone所有机型的qq浏览器,safari浏览器,微信内置浏览器(qq浏览器内核)等. 二. 异常现象: 1. 大幅度上下滑动h5页面,然后停止滑动,有时候会影响到页面滚动,如局 ...

  8. iOS 一个app跳转另一个app并实现通信(如A跳到B并打开B中指定页面)

    功能实现:A跳到B并打开B中指定页面 步骤: 1.首先创建两个项目(项目A,项目B),在项目B中的info.plist文件中添加URL Types,如下图所示:其中URL idenifier是项目B的 ...

  9. 谈谈iOS中的屏幕方向

    众所周知,iOS中提供了[UIDevice currentDevice].orientation与[UIApplication sharedApplication].statusBarOrientat ...

随机推荐

  1. solr建立pdf/word/excel索引的方法

    PS: 本文假设你已经成功的搭建了一个Solr服务器步骤如下:(1)准备好一份Solr的源码,假设现在保存在c:\apache-solr-1.4.1\目录下(2)从https://issues.apa ...

  2. 如何确定HyperThreading是否在Linux上已开启?

    命令如下: dmidecode -t processor | grep HTT 参考资料 ============= https://unix.stackexchange.com/questions/ ...

  3. 什么是Platform Services Controller

    Platform Services Controller (PSC) is a component of the VMware Cloud Infrastructure Suite. PSC deal ...

  4. SQL Server 2005 Integration Services (SSIS)数据源之MySQL

    一安装MySQL数据库的ODBC驱动 下载MySQL Connector ODBC 3.51.rar 单击setup按默认安装即可! 如下图所示,在ODBC数据源管理器中看到“MySQL ODBC 3 ...

  5. 原生javascript实现异步的7种方式

    1.$(document).ready 点评: 需要引用jquery :兼容所有浏览器. 2.标签的async=”async”属性 async的定义和用法(是HTML5的属性) async 属性规定一 ...

  6. 10个在UNIX或Linux终端上快速工作的建议

    你有没有惊讶地看到有人在Unix/ Linux中工作得非常快,噼里啪啦的敲键盘,快速的启动命令,飞快地执行命令? 在本文中,我共享了一些在Linux中快速.高效工作所遵循的Unix/ Linux命令实 ...

  7. Mongoose JS findOne always returns null

      [问题] I've been fighting with trying to get Mongoose to return data from my local MongoDB instance; ...

  8. servlet种下cookie后如何携带cookie继续往下走

    事情是这样的,今天我在应用1里面手动种下了一个cookie,然后它会发接着访问应用2,因为是我手动setCookie,所以它还没来得及携带cookie继续前往下一站,于是,apple pen,炸了. ...

  9. JavaScript 将行结构数据转化为树形结构,可提供给常用的tree插件直接使用(高效转化方案)

    前台接收到的数据格式 var rows=[{ parent: 'root', id: 'DC', title: '集团' }, { parent: 'DC', id: '01', title: '上海 ...

  10. windows安装mycat(转)

    http://blog.csdn.net/sc9018181134/article/details/53063798 1.先到github上下载mycat 2.下载完成后,解压.应该是这样一个样子 3 ...