- (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. MultipleRegularExpressionAttribute MVC中扩展自定义验证规则

    好久都没有写博客,最近工作中没有什么可写的,公司的项目是以业务为重,技术含量实在不咋的.这次sprint中有一个要求就是password必须一些规则,比如给你一些正则表达式必须满足几个,直接看效果吧 ...

  2. windows钩子(转)

    1. 消息钩子 提示: 如果要设置系统级钩子, 钩子函数必须在 DLL 中. SetWindowsHookEx(   idHook: Integer;  {钩子类型}   lpfn: TFNHookP ...

  3. [leetcode]Clone Graph @ Python

    原题地址:https://oj.leetcode.com/problems/clone-graph/ 题意:实现对一个图的深拷贝. 解题思路:由于遍历一个图有两种方式:bfs和dfs.所以深拷贝一个图 ...

  4. 荔枝FM 字体文件 IconFontTextView

    使用效果 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android ...

  5. Jquery怎么获取select选中项 自定义属性的值

    Jquery如何获取select选中项 自定义属性的值?HTML code <select id="ddl" onchange="ddl_change(this)& ...

  6. js时间戳怎么转成日期格式

    原文地址:http://www.sufeinet.com/thread-1500-1-1.html js时间戳怎么转成日期格式这个在主群里有朋友§☆釺哖蟲...o问js时间戳怎么转成日期格式 ,他的问 ...

  7. 实例游戏内存修改器----CUI版本模拟

    实现说明: 目标进程内存中很可能存在多个你要搜索的值, 所以在进行第一次搜索的时候, 要把搜索到的地址记录下来,然后让用户改变要搜索的值,再在记录的地址中搜索,直到搜索到的地址惟一为止.为此写两个辅助 ...

  8. AngulerJS学习(五)按需动态载入文件

    在此之前我么年首先要先了解几个东西: $q 简单介绍: $q:主要解决的是异步编程的问题,是指描写叙述通过一个承诺行为与对象代表的异步运行的行动结果的交互.可能会也可能不会再不论什么时候完毕. 我们通 ...

  9. Spark:java api实现word count统计

    方案一:使用reduceByKey 数据word.txt 张三 李四 王五 李四 王五 李四 王五 李四 王五 王五 李四 李四 李四 李四 李四 代码: import org.apache.spar ...

  10. 一分钟读懂互联网广告竞价策略GFP+GSP+VCG

    原文:http://ju.outofmemory.cn/entry/116780 一分钟读懂互联网广告竞价策略GFP+GSP+VCG 两个广告位,三家广告主竞价,广告平台究竟应该制定广告竞价策略呢?这 ...