今天在項(xiàng)目中空执,需要將一個(gè)彈窗加載到啟動(dòng)圖界面瞎访,由于我們本身無法控制啟動(dòng)圖隨時(shí)結(jié)束灿渴,所以我在launch方法中沮稚,給window的rootviewcontroller添加了一個(gè)圖片艺沼,這個(gè)圖片就是取自我們的啟動(dòng)圖,這樣就會(huì)有一種啟動(dòng)圖一直未消失的假象蕴掏。獲取圖片的方法如下:
- (UIImage *)getLaunchImage {
UIImage *launchImg = [[UIImage alloc] init];
NSString *orientation = @"";
CGSize screenSize = [UIScreen mainScreen].bounds.size;
UIInterfaceOrientation statusBarOrientation = [[UIApplication sharedApplication] statusBarOrientation];
if (statusBarOrientation == UIInterfaceOrientationLandscapeLeft || statusBarOrientation == UIInterfaceOrientationLandscapeRight) {
orientation = @"Landscape";
} else {
orientation = @"Portrait";
}
NSArray *imgsInfoArr = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"UILaunchImages"];
for (NSDictionary *info in imgsInfoArr) {
CGSize imgSize = CGSizeFromString(info[@"UILaunchImageSize"]);
if (CGSizeEqualToSize(imgSize, screenSize) && [orientation isEqualToString:info[@"UILaunchImageOrientation"]] ) {
launchImg = [UIImage imageNamed:info[@"UILaunchImageName"]];
}
}
return launchImg;
}