iOS开发之获取LaunchImage启动图的实例
程序员文章站
2023-12-19 17:08:10
实例如下:
#define kyrect [uiscreen mainscreen].bounds
//获取启动图片
cgsize viewsize =...
实例如下:
#define kyrect [uiscreen mainscreen].bounds //获取启动图片 cgsize viewsize = kyrect.size; //横屏请设置成 @"landscape" nsstring *vieworientation = @"portrait"; nsstring *launchimagename = nil; nsarray* imagesdict = [[[nsbundle mainbundle] infodictionary] valueforkey:@"uilaunchimages"]; for (nsdictionary* dict in imagesdict) { cgsize imagesize = cgsizefromstring(dict[@"uilaunchimagesize"]); if (cgsizeequaltosize(imagesize, viewsize) && [vieworientation isequaltostring:dict[@"uilaunchimageorientation"]]) { launchimagename = dict[@"uilaunchimagename"]; } } uiimage * launchimage = [uiimage imagenamed:launchimagename]; //将当前view的背景图设置为启动图片 self.view.backgroundcolor = [uicolor colorwithpatternimage:launchimage];
以上这篇ios开发之获取launchimage启动图的实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。