您的位置:首页 > 其它

设置启动页图

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中添加所要实现的功能
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: