- (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. Cesium学习笔记(七):Demo学习(自由控制飞行的飞机)[转]

    https://blog.csdn.net/umgsoil/article/details/74923013# 这是官方的教程Demo,名字叫Use HeadingPitchRoll,顾名思义,就是教 ...

  2. VS2010新建Web网站与新建Web应用程序的区别 (转)

    在Visual Studio 2010中,除了可以使用“创建Web应用程序”的方式来构建自己的Web项目之外,还可以通过创建“Web网站”的方式来构建Web项其中,Web网站的创建方法:打开Visua ...

  3. [leetcode]Reverse Words in a String @ Python

    原题地址:https://oj.leetcode.com/problems/reverse-words-in-a-string/ 题意: Given an input string, reverse ...

  4. COCO数据集深入理解

    TensorExpand/TensorExpand/Object detection/Data_interface/MSCOCO/ 深度学习数据集介绍及相互转换 Object segmentation ...

  5. ubuntu 下python环境的切换使用

    如何在Anaconda的python和系统自带的python之间切换 一般ubuntu下有三种python环境,1. 系统自带python2,3;在/usr/bin路径下:2. anaconda下安装 ...

  6. Windows server 2012 R2 与 Windows 2016 的双系统重启选项

    一台主机上,同时安装了Windows 2012R2还有Windows 2016, 但是如何能在任意一个系统重启到另一个呢? 下图中,在Win2012R2中,无法选择重启到2016中. 解决方案 === ...

  7. js中各种跨域问题实战小结

    什么是跨域?为什么要实现跨域呢?   这是因为JavaScript出于安全方面的考虑,不允许跨域调用其他页面的对象.也就是说只能访问同一个域中的资源.我觉得这就有必要了解下javascript中的同源 ...

  8. CMenu and Dialog-based applications

    [问] Is it possible to put a menu in a dialog based application? How? [答] Yes, it is possible to add ...

  9. 使用phpqrcode生成二维码

    使用PHP语言生成二维码,还是挺有难度的,当然调用生成二维码图片的接口(比如:联图网http://www.liantu.com/的接口)除外,如果自己写代码生成,真的无从下手.然而,我们可以使用php ...

  10. [Canvas]人物型英雄出现(前作仅为箭头)

    源码点此下载,用浏览器打开index.html观看. 代码: <!DOCTYPE html> <html lang="utf-8"> <meta ht ...