从Images.xcassets获取默认启动图LaunchImage
有很多童鞋在开发中,需要获取默认启动图,但是又不想多添加一次,使程序包增大,而以前的获取办法又不管用,到底怎样才能获取到呢?
- self.startImageView = [[UIImageView alloc] initWithFrame:self.window.bounds];
- f (iPhone5) {
- self.startImageView.image = [UIImage imageNamed:@"LaunchImage-700-568h"];
- }else if (iPhone6) {
- self.startImageView.image = [UIImage imageNamed:@"LaunchImage-800-667h"];
- }else if (iPhone6Plus) {
- self.startImageView.image = [UIImage imageNamed:@"LaunchImage-800-Portrait-736h"];
- }else {
- self.startImageView.image = [UIImage imageNamed:@"LaunchImage-700"];
- }
- [self.window addSubview:self.startImageView];
如果你程序兼容7.0以下,那么你就需要判断版本,因为在ios6上获取启动图是@“LaunchImage”