设置启动页图
2016-04-14 11:10
323 查看
若想简单的实现添加一张网络的启动图或者动态的启动图可使用改方法:
在appdelegate中的didFinishLaunchingWithOptions方法中写:
//启动页
@property (strong, nonatomic) UIView *ADView;
@property (strong, nonatomic) UIImageView *imageV;
{
[self.window makeKeyAndVisible];
UIStoryboard *launchStoryboard = [UIStoryboard storyboardWithName:@"LaunchScreen" bundle:nil];
UIViewController *vc = (UIViewController *)[launchStoryboard instantiateViewControllerWithIdentifier:@"LaunchScreen"];
self.ADView = (UIView *)vc.view;
self.ADView.frame = CGRectMake(0, 0, UISCREEN.width, UISCREEN.height);
[self.window addSubview:self.ADView];
self.imageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, UISCREEN.width, UISCREEN.height)];
//若不图片的地址是动态的,则还需进行网络请求,但在 didFinishLaunchingWithOptions方法中不宜使用线程下载网络资源.
NSString *str2 = @"http://img.itc.cn/photo/odVUMldO6Oj";
[self.ADView addSubview:self.imageV];
[self.window bringSubviewToFront:self.ADView];
[NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(removeADView) userInfo:nil repeats:NO];
return YES;
}
在removeADView该方法中移除添加的view
这只是实现简单的需求,若复杂的需求还需在启动是创建VC,在VC中添加所要实现的功能
在appdelegate中的didFinishLaunchingWithOptions方法中写:
//启动页
@property (strong, nonatomic) UIView *ADView;
@property (strong, nonatomic) UIImageView *imageV;
{
[self.window makeKeyAndVisible];
UIStoryboard *launchStoryboard = [UIStoryboard storyboardWithName:@"LaunchScreen" bundle:nil];
UIViewController *vc = (UIViewController *)[launchStoryboard instantiateViewControllerWithIdentifier:@"LaunchScreen"];
self.ADView = (UIView *)vc.view;
self.ADView.frame = CGRectMake(0, 0, UISCREEN.width, UISCREEN.height);
[self.window addSubview:self.ADView];
self.imageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, UISCREEN.width, UISCREEN.height)];
//若不图片的地址是动态的,则还需进行网络请求,但在 didFinishLaunchingWithOptions方法中不宜使用线程下载网络资源.
NSString *str2 = @"http://img.itc.cn/photo/odVUMldO6Oj";
[self.ADView addSubview:self.imageV];
[self.window bringSubviewToFront:self.ADView];
[NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(removeADView) userInfo:nil repeats:NO];
return YES;
}
在removeADView该方法中移除添加的view
这只是实现简单的需求,若复杂的需求还需在启动是创建VC,在VC中添加所要实现的功能
相关文章推荐
- PHP原生态记录Log函数
- Wordpress (Does page has children?)
- 管道
- android版本兼容,高版本低版本兼容性
- 使用 Swagger UI 与 Swashbuckle 创建 RESTful Web API 帮助文件
- error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏。
- SugarORM的操作
- JavaScript 中判断对象的类型
- DDMS files not found: tools\hprof-conv.exe
- CoreText图文混排 ,学习随笔记录
- 1011. World Cup Betting (20)
- 基于cryptopp -- A Password Manager密码管理系统
- Android 手动显示和隐藏软键盘
- 如何监控MySQL性能
- leetcode整理的资料(第一篇)
- 跨页面a标签锚点
- jsp标签和el表达式
- Swift编程规范:保持代码优美的10个方法
- React Native——flex布局
- Win32汇编 高DPI下如何获取屏幕物理分辨率(Native solution)