iOS获取AppIcon and LaunchImage's name(app图标和启动图片名字)

在某种场景下,可能我们需要获取app的图标名称和启动图片的名称。比如说app在前台时,收到了远程通知但是通知栏是不会有通知提醒的,这时我想做个模拟通知提示,需要用到icon名称;再比如在加载某个控制器时,想设置该控制器的背景图片为启动图片,需要用到启动图片名称。

  而事实上icon图片放在系统AppIcon文件夹里,启动图片放在系统LaunchImage文件夹里,取这些图片的名称和其他一般资源图片名称不一样。

  为了方便举例子,咱们先简单粗暴点

假设当前项目只支持iPhone设备,并且只支持竖屏;而且当前项目里已经设置好了AppIcon图标和启动图片,

如何获取icon图标名称和启动图片名称呢 ?

上代码和打印日志:

/** 获取app的icon图标名称 */
- (void)getAppIconName{
NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];
//获取app中所有icon名字数组
NSArray *iconsArr = infoDict[@"CFBundleIcons"][@"CFBundlePrimaryIcon"][@"CFBundleIconFiles"];
//取最后一个icon的名字
NSString *iconLastName = [iconsArr lastObject];
//打印icon名字
NSLog(@"iconsArr: %@", iconsArr);
NSLog(@"iconLastName: %@", iconLastName);
/*
打印日志:
iconsArr: (
AppIcon29x29,
AppIcon40x40,
AppIcon60x60
)
iconLastName: AppIcon60x60
*/
}
/** 获取app的启动图片名称,并设置为本控制器背景图片 */
- (void)getLaunchImageName{
NSString *launchImageName = @""; //启动图片名称变量
CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height;
//获取与当前设备匹配的启动图片名称
if (screenHeight == 480){ //4,4S
launchImageName = @"LaunchImage-700";
}
else if (screenHeight == 568){ //5, 5C, 5S, iPod
launchImageName = @"LaunchImage-700-568h";
}
else if (screenHeight == 667){ //6, 6S
launchImageName = @"LaunchImage-800-667h";
}
else if (screenHeight == 736){ // 6Plus, 6SPlus
launchImageName = @"LaunchImage-800-Landscape-736h";
}
if (launchImageName.length < 1) return;
//设备启动图片为控制器的背景图片
UIImage *img = [UIImage imageNamed:launchImageName];
self.view.backgroundColor = [UIColor colorWithPatternImage:img];
}

打印当前只支持iPhone设备并且只支持竖屏场景下的所有启动图片信息:

/** 打印app里面所有启动图片名称信息 */
- (void)printAllLaunchImageInfo{
 NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];
 //获取所有启动图片信息数组
 NSArray *launchImagesArr = infoDict[@"UILaunchImages"];
 NSLog(@"launchImagesArr: %@", launchImagesArr);
 /*
 打印日志:启动图片的名字是固定的
 launchImagesArr: (
  {
  UILaunchImageMinimumOSVersion = "8.0";
  UILaunchImageName = "LaunchImage-800-Portrait-736h";
  UILaunchImageOrientation = Portrait;
  UILaunchImageSize = "{414, 736}";
  },
  {
  UILaunchImageMinimumOSVersion = "8.0";
  UILaunchImageName = "LaunchImage-800-Landscape-736h";
  UILaunchImageOrientation = Landscape;
  UILaunchImageSize = "{414, 736}";
  },
  {
  UILaunchImageMinimumOSVersion = "8.0";
  UILaunchImageName = "LaunchImage-800-667h";
  UILaunchImageOrientation = Portrait;
  UILaunchImageSize = "{375, 667}";
  },
  {
  UILaunchImageMinimumOSVersion = "7.0";
  UILaunchImageName = "LaunchImage-700";
  UILaunchImageOrientation = Portrait;
  UILaunchImageSize = "{320, 480}";
  },
  {
  UILaunchImageMinimumOSVersion = "7.0";
  UILaunchImageName = "LaunchImage-700-568h";
  UILaunchImageOrientation = Portrait;
  UILaunchImageSize = "{320, 568}";
  }
 )
 */
}

看到了,项目AppIcon图标和启动图片信息,都可以从 [[NSBundle mainBundle] infoDictionary] 获得,当前这里面还包含了app的其他信息如版本、app名称、设备类型、支持方向。。。

打印所有信息看看:

/** 打印app工程配置信息 */
- (void)printInfoDictionary{
 NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];
 NSLog(@"%@", infoDict);
 /*
 打印日志:
 {
  BuildMachineOSBuild = 15G31;
  CFBundleDevelopmentRegion = en;
  CFBundleExecutable = TanTest;
  CFBundleIcons = {
  CFBundlePrimaryIcon =  {
   CFBundleIconFiles =  (
   AppIcon29x29,
   AppIcon40x40,
   AppIcon60x60
   );
  };
  };
  CFBundleIdentifier = "net.tan.xxx";
  CFBundleInfoDictionaryVersion = "6.0";
  CFBundleInfoPlistURL = "Info.plist -- file:///Users/PX/Library/Developer/CoreSimulator/Devices/7020368B-C160-42C0-B3C5-5F958FA82EF5/data/Containers/Bundle/Application/77D8C333-A6AF-4183-B79A-A5BEDCD08E1A/TanTest.app/";
  CFBundleName = TanTest;
  CFBundleNumericVersion = 16809984;
  CFBundlePackageType = APPL;
  CFBundleShortVersionString = "1.0";
  CFBundleSignature = "????";
  CFBundleSupportedPlatforms = (
  iPhoneSimulator
  );
  CFBundleVersion = 1;
  DTCompiler = "com.apple.compilers.llvm.clang.1_0";
  DTPlatformBuild = "";
  DTPlatformName = iphonesimulator;
  DTPlatformVersion = "9.3";
  DTSDKBuild = 13E230;
  DTSDKName = "iphonesimulator9.3";
  DTXcode = 0731;
  DTXcodeBuild = 7D1014;
  LSRequiresIPhoneOS = 1;
  MinimumOSVersion = "6.0";
  UIDeviceFamily = (
  );
  UILaunchImageFile = LaunchImage;
  UILaunchImages = (
  {
   UILaunchImageMinimumOSVersion = "8.0";
   UILaunchImageName = "LaunchImage-800-Portrait-736h";
   UILaunchImageOrientation = Portrait;
   UILaunchImageSize = "{414, 736}";
  },
  {
   UILaunchImageMinimumOSVersion = "8.0";
   UILaunchImageName = "LaunchImage-800-Landscape-736h";
   UILaunchImageOrientation = Landscape;
   UILaunchImageSize = "{414, 736}";
  },
  {
   UILaunchImageMinimumOSVersion = "8.0";
   UILaunchImageName = "LaunchImage-800-667h";
   UILaunchImageOrientation = Portrait;
   UILaunchImageSize = "{375, 667}";
  },
  {
   UILaunchImageMinimumOSVersion = "7.0";
   UILaunchImageName = "LaunchImage-700";
   UILaunchImageOrientation = Portrait;
   UILaunchImageSize = "{320, 480}";
  },
  {
   UILaunchImageMinimumOSVersion = "7.0";
   UILaunchImageName = "LaunchImage-700-568h";
   UILaunchImageOrientation = Portrait;
   UILaunchImageSize = "{320, 568}";
  }
  );
  UILaunchStoryboardName = LaunchScreen;
  UIMainStoryboardFile = Main;
  UIRequiredDeviceCapabilities = (
  armv7
  );
  UISupportedInterfaceOrientations = (
  UIInterfaceOrientationPortrait
  );
 }
 */
}

---------- 接下来我们再来在app既支持iPhone和iPad设备,又支持横屏和竖屏时,AppIcon和LaunchImage是怎样的以及如何获取 ---

先上两张图,再上测试代码:

测试代码:

1、获取AppIcon所有icon图标名称

/** 支持iPhone和iPad, 获取app的icon图标名称 */
- (void)getAppIconName{
 NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];
 //获取app中所有icon名字数组
 NSArray *iconsArr = infoDict[@"CFBundleIcons"][@"CFBundlePrimaryIcon"][@"CFBundleIconFiles"];
 //取最后一个icon的名字
 NSString *iconLastName = [iconsArr lastObject];
 //打印icon名字
 NSLog(@"iconsArr: %@", iconsArr);
 NSLog(@"iconLastName: %@", iconLastName);
 /*
 打印日志(29pt和40pt iPhone和iPad都用到;60pt --- iPhone, 76pt和83.5pt --- iPad):
 iconsArr: (
  AppIcon29x29,
  AppIcon40x40,
  AppIcon60x60,
  AppIcon76x76,
  "AppIcon83.5x83.5"
 )
 iconLastName: AppIcon83.5x83.5
 */
}

2、获取在支持iPhone和iPad开发,支持横屏和竖屏时,获取启动图片,并设为背景图片代码

(iPhone设备只有在Plus, 即5.5英寸才有竖屏和横屏两套图片,其他4、5、6竖屏横屏共用一张启动图片)

/**
 支持iPhone和iPad, 支持横屏、竖屏,
 获取app的启动图片名称,并设置为本控制器背景图片
 */
- (void)getLaunchImageName{
 NSString *launchImageName = @""; //启动图片名称变量
 CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height; //屏幕高度
 CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width; //屏幕宽度
 //设备界面方向
 UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
 BOOL isPortrait = UIInterfaceOrientationIsPortrait(orientation);// 是否竖屏
 BOOL isLandscape = UIInterfaceOrientationIsLandscape(orientation);//是否横屏
 //获取与当前设备匹配的启动图片名称
 //4、4S 竖屏,横屏
 if ((isPortrait && screenHeight == 480) || (isLandscape && screenWidth == 480)){
 launchImageName = @"LaunchImage-700";
 }
 //5、5C、5S、iPod 竖屏,横屏
 else if ((isPortrait && screenHeight == 568) || (isLandscape && screenWidth == 568)){
 launchImageName = @"LaunchImage-700-568h";
 }
 //6、6S 竖屏,横屏
 else if ((isPortrait && screenHeight == 667) || (isLandscape && screenWidth == 667)){
 launchImageName = @"LaunchImage-800-667h";
 }
 //6Plus、6SPlus竖屏
 else if (isPortrait && screenHeight == 736){
 launchImageName = @"LaunchImage-800-Portrait-736h";
 }
 //6Plus、6SPlus 横屏
 else if (isLandscape && screenWidth == 736){
 launchImageName = @"LaunchImage-800-Landscape-736h";
 }
 //iPad 竖屏
 else if (isPortrait && screenHeight == 1024){
 launchImageName = @"LaunchImage-700-Portrait";
 }
 //iPad 横屏
 else if (isLandscape && screenWidth == 1024){
 launchImageName = @"LaunchImage-700-Landscape";
 }
 if (launchImageName.length < 1) return;
 //设备启动图片为控制器的背景图片
 UIImage *img = [UIImage imageNamed:launchImageName];
 self.view.backgroundColor = [UIColor colorWithPatternImage:img];
}

3、打印出所有启动图片信息

/** 打印app里面所有启动图片名称信息 */
- (void)printAllLaunchImageInfo{
 NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];
 //获取所有启动图片信息数组
 NSArray *launchImagesArr = infoDict[@"UILaunchImages"];
 NSLog(@"launchImagesArr: %@", launchImagesArr);
 /*
 打印日志:启动图片的名字是固定的
 launchImagesArr: (
  {
  UILaunchImageMinimumOSVersion = "8.0";
  UILaunchImageName = "LaunchImage-800-Portrait-736h";
  UILaunchImageOrientation = Portrait;
  UILaunchImageSize = "{414, 736}";
  },
  {
  UILaunchImageMinimumOSVersion = "8.0";
  UILaunchImageName = "LaunchImage-800-Landscape-736h";
  UILaunchImageOrientation = Landscape;
  UILaunchImageSize = "{414, 736}";
  },
  {
  UILaunchImageMinimumOSVersion = "8.0";
  UILaunchImageName = "LaunchImage-800-667h";
  UILaunchImageOrientation = Portrait;
  UILaunchImageSize = "{375, 667}";
  },
  {
  UILaunchImageMinimumOSVersion = "7.0";
  UILaunchImageName = "LaunchImage-700";
  UILaunchImageOrientation = Portrait;
  UILaunchImageSize = "{320, 480}";
  },
  {
  UILaunchImageMinimumOSVersion = "7.0";
  UILaunchImageName = "LaunchImage-700-568h";
  UILaunchImageOrientation = Portrait;
  UILaunchImageSize = "{320, 568}";
  },
  {
  UILaunchImageMinimumOSVersion = "7.0";
  UILaunchImageName = "LaunchImage-700-Portrait";
  UILaunchImageOrientation = Portrait;
  UILaunchImageSize = "{768, 1024}";
  },
  {
  UILaunchImageMinimumOSVersion = "7.0";
  UILaunchImageName = "LaunchImage-700-Landscape";
  UILaunchImageOrientation = Landscape;
  UILaunchImageSize = "{768, 1024}";
  }
 )
 */
}

4、打印所有配置信息

/** 打印app工程配置信息 */
- (void)printInfoDictionary{
 NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];
 NSLog(@"%@", infoDict);
 /*
 打印日志:
 {
 BuildMachineOSBuild = 15G31;
 CFBundleDevelopmentRegion = en;
 CFBundleExecutable = TanTest;
 CFBundleIcons = {
  CFBundlePrimaryIcon =  {
  CFBundleIconFiles =  (
       AppIcon29x29,
       AppIcon40x40,
       AppIcon60x60,
       AppIcon76x76,
       "AppIcon83.5x83.5"
       );
  };
 };
 CFBundleIdentifier = "net.tan.xxx";
 CFBundleInfoDictionaryVersion = "6.0";
 CFBundleInfoPlistURL = "Info.plist -- file:///Users/PX/Library/Developer/CoreSimulator/Devices/3246F9AE-1D73-4E4F-8DDF-F591DBE64F63/data/Containers/Bundle/Application/7DD6C793-F882-43CF-9897-1433411289E6/TanTest.app/";
 CFBundleName = TanTest;
 CFBundleNumericVersion = 16809984;
 CFBundlePackageType = APPL;
 CFBundleShortVersionString = "1.0";
 CFBundleSignature = "????";
 CFBundleSupportedPlatforms = (
      iPhoneSimulator
      );
 CFBundleVersion = 1;
 DTCompiler = "com.apple.compilers.llvm.clang.1_0";
 DTPlatformBuild = "";
 DTPlatformName = iphonesimulator;
 DTPlatformVersion = "9.3";
 DTSDKBuild = 13E230;
 DTSDKName = "iphonesimulator9.3";
 DTXcode = 0731;
 DTXcodeBuild = 7D1014;
 LSRequiresIPhoneOS = 1;
 MinimumOSVersion = "9.0";
 UIDeviceFamily = (
    1,
    );
 UILaunchImageFile = LaunchImage;
 UILaunchImages = (
    {
     UILaunchImageMinimumOSVersion = "8.0";
     UILaunchImageName = "LaunchImage-800-Portrait-736h";
     UILaunchImageOrientation = Portrait;
     UILaunchImageSize = "{414, 736}";
    },
    {
     UILaunchImageMinimumOSVersion = "8.0";
     UILaunchImageName = "LaunchImage-800-Landscape-736h";
     UILaunchImageOrientation = Landscape;
     UILaunchImageSize = "{414, 736}";
    },
    {
     UILaunchImageMinimumOSVersion = "8.0";
     UILaunchImageName = "LaunchImage-800-667h";
     UILaunchImageOrientation = Portrait;
     UILaunchImageSize = "{375, 667}";
    },
    {
     UILaunchImageMinimumOSVersion = "7.0";
     UILaunchImageName = "LaunchImage-700";
     UILaunchImageOrientation = Portrait;
     UILaunchImageSize = "{320, 480}";
    },
    {
     UILaunchImageMinimumOSVersion = "7.0";
     UILaunchImageName = "LaunchImage-700-568h";
     UILaunchImageOrientation = Portrait;
     UILaunchImageSize = "{320, 568}";
    },
    {
     UILaunchImageMinimumOSVersion = "7.0";
     UILaunchImageName = "LaunchImage-700-Portrait";
     UILaunchImageOrientation = Portrait;
     UILaunchImageSize = "{768, 1024}";
    },
    {
     UILaunchImageMinimumOSVersion = "7.0";
     UILaunchImageName = "LaunchImage-700-Landscape";
     UILaunchImageOrientation = Landscape;
     UILaunchImageSize = "{768, 1024}";
    }
    );
 UILaunchStoryboardName = LaunchScreen;
 UIMainStoryboardFile = Main;
 UIRequiredDeviceCapabilities = (
      armv7
      );
 UISupportedInterfaceOrientations = (
      UIInterfaceOrientationPortrait,
      UIInterfaceOrientationLandscapeLeft,
      UIInterfaceOrientationLandscapeRight
      );
 }*/
}

以上所述是小编给大家介绍的iOS获取AppIcon and LaunchImage's name(app图标和启动图片名字),希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对我们网站的支持!

(0)

相关推荐

  • iOS11&iPhoneX适配&Xcode9打包注意事项

    1,适配UITableView if#available(iOS11.0, *) { self.contentInsetAdjustmentBehavior= .never self.estimatedRowHeight=0 self.estimatedSectionHeaderHeight=0 self.estimatedSectionFooterHeight=0 }else{ } 2,适配UIScrollView if#available(iOS11.0, *) { scrollView?.

  • 浅谈Xcode9 和iOS11适配和特性

    今天升级了Xcode9 刚才写了一篇 爱劈叉的齐刘海 现在说说新的东西把,有些简直不能再恶心了但有些简直不能再贴心 首先是跳转, 之前按住Command + 左键 就可以跳转了;然而今天我发现 除了这个: Jump to Definition(^⌘):跳转类头文件或定义 Show Quick Help(⌥):显示帮助文档 Edit All in Scope:编辑文档内所有匹配内容 在这里我要说,对于懒得不行的我,简直要吐,多了一步操作 效率降低很多的好吗? 那么好,你试试 Command + 右

  • iOS 11 AppIcon不显示问题小结

    今天更新Xcode 9 后,在运行老项目时遇到一个小坑,就是无论如何都不显示AppIcon,在网络上找到了方法,单并没有解决,其实不是方法的问题,只是有一个小细节要注意,在这里提示一下. 出现这个问题的原因就是cocoapods与iOS 11出现点问题,这里你要更新你的cocoapods至最新版本.然后在你的Podfile文件中添加如下代码.这里一定要注意,要在end下面,如图所示 代码: post_install do |installer| copy_pods_resources_path

  • iOS11上Xcode9 AppIcon 图标不显示

    实例一: 打开工程目录下:[工程名]/Pods/Target Support Files/Pods-[工程名]/Pods-[工程名]-resources.sh这个文件,替换最后一段代码: 修改前: printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${

  • 详解iOS11、iPhone X、Xcode9 适配指南

    更新iOS11后,发现有些地方需要做适配,整理后按照优先级分为以下三类: 单纯升级iOS11后造成的变化: Xcode9 打包后造成的变化: iPhoneX的适配 一.单纯升级iOS11后造成的变化 升级后,发现某个拥有tableView的界面错乱,组间距和contentInset错乱,因为iOS11中 UIViewController 的 automaticallyAdjustsScrollViewInsets 属性被废弃了,因此当tableView超出安全区域时,系统自动会调整SafeAre

  • iOS获取AppIcon and LaunchImage's name(app图标和启动图片名字)

    在某种场景下,可能我们需要获取app的图标名称和启动图片的名称.比如说app在前台时,收到了远程通知但是通知栏是不会有通知提醒的,这时我想做个模拟通知提示,需要用到icon名称:再比如在加载某个控制器时,想设置该控制器的背景图片为启动图片,需要用到启动图片名称. 而事实上icon图片放在系统AppIcon文件夹里,启动图片放在系统LaunchImage文件夹里,取这些图片的名称和其他一般资源图片名称不一样. 为了方便举例子,咱们先简单粗暴点 假设当前项目只支持iPhone设备,并且只支持竖屏:而

  • iOS获取AppIcon and LaunchImage's name(app图标和启动图片名字)

    在某种场景下,可能我们需要获取app的图标名称和启动图片的名称.比如说app在前台时,收到了远程通知但是通知栏是不会有通知提醒的,这时我想做个模拟通知提示,需要用到icon名称:再比如在加载某个控制器时,想设置该控制器的背景图片为启动图片,需要用到启动图片名称. 而事实上icon图片放在系统AppIcon文件夹里,启动图片放在系统LaunchImage文件夹里,取这些图片的名称和其他一般资源图片名称不一样. 为了方便举例子,咱们先简单粗暴点 假设当前项目只支持iPhone设备,并且只支持竖屏:而

  • IOS App图标和启动画面尺寸详细介绍

    iOS App图标和启动画面尺寸   注意:iOS所有图标的圆角效果由系统生成,给到的图标本身不能是圆角的. 1. 桌面图标 (app icon) for iPhone6 plus(@3x) : 180 x 180 for iPhone 6/5s/5/4s/4(@2x) : 120 x 120 2. 系统搜索框图标 (Spotlight search results icon)   for iPhone6 plus(@3x) : 120 x 120 for iPhone6/5s/5/4s/4(@

  • IOS 获取APP 版本号的实例详解

    IOS 获取APP 版本号的实例详解 看代码的时候看到一句,用于获取.plist文件的版本号 labelVersion.text = [NSString stringWithFormat:@"v%@", [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString*)kCFBundleVersionKey]]; 比较感兴趣的是后面的参数 kcFBundleVersionKey ,竟然是CFBundle.h已经定于好的属性,下面有

  • IOS获取各种文件目录路径的方法

    iphone沙箱模型有四个文件夹,分别是什么,永久数据存储一般放在什么位置,得到模拟器的路径的简单方式是什么. documents,tmp,app,Library. (NSHomeDirectory()), 手动保存的文件在documents文件里 Nsuserdefaults保存的文件在tmp文件夹里 1.Documents 目录:您应该将所有de应用程序数据文件写入到这个目录下.这个目录用于存储用户数据或其它应该定期备份的信息. 2.AppName.app 目录:这是应用程序的程序包目录,包

  • IOS获取缓存文件的大小并清除缓存文件的方法

    移动应用在处理网络资源时,一般都会做离线缓存处理,其中以图片缓存最为典型,其中很流行的离线缓存框架为SDWebImage. 但是,离线缓存会占用手机存储空间,所以缓存清理功能基本成为资讯.购物.阅读类app的标配功能. 今天介绍的离线缓存功能的实现,主要分为缓存文件大小的获取.清除缓存文件的实现. 1. 获取缓存文件的大小 -( float )readCacheSize { NSString *cachePath = [NSSearchPathForDirectoriesInDomains (N

  • iOS获取设备唯一标识的8种方法

    8种iOS获取设备唯一标识的方法,希望对大家有用. UDID UDID(Unique Device Identifier),iOS 设备的唯一识别码,是一个40位十六进制序列(越狱的设备通过某些工具可以改变设备的 UDID),移动网络可以利用 UDID 来识别移动设备. 许多开发者把 UDID 跟用户的真实姓名.密码.住址.其它数据关联起来,网络窥探者会从多个应用收集这些数据,然后顺藤摸瓜得到这个人的许多隐私数据,同时大部分应用确实在频繁传输 UDID 和私人信息. 为了避免集体诉讼,苹果最终决

  • 详解iOS获取通讯录的4种方式

    本文实例为大家分享了iOS获取通讯录的4种方式,供大家参考,具体内容如下 使用场景 一些App通过手机号码来推荐好友,如 微博.支付宝 首先客户端会获取通讯录中的所有手机号然后将这些手机号提交到App服务器中,服务器会查找每个手机号对应的App账号如QQ号码返回到客户端,然后客户端根据服务器返回的账号列表来推荐好友. 获取联系人方式 方案一:AddressBookUI.framework框架 提供了联系人列表界面.联系人详情界面.添加联系人界面等 一般用于选择联系人 方案二:AddressBoo

  • iOS 获取当前的ViewController的方法

    本文介绍了iOS 获取当前的ViewController,分享给大家.具体如下 通过简单的判断[UIViewController class],就认定它是想要的控制器是不对的: if ([nextResponder isKindOfClass:[UIViewController class]]) { result = nextResponder; }else { result = window.rootViewController; } 因为:isKindOfClass:确定一个对象是否是一个类

  • iOS获取手机通讯录方式方法(最新)

    最近学习了iOS获取手机通讯录方式方法,现在分享给大家.希望此文章对各位有所帮助. 一.iOS 9 以前的通讯录框架 AddressBookUI框架:提供了联系人列表界面.联系人详情界面.添加联系人界面等,一般用于选择联系人. AddressBook 框架:纯 C 语言的 API,仅仅是获得联系人数据.没有提供 UI 界面展示,需要自己搭建联系人展示界面. 二. iOS 9 以后最新通讯录框架 ContactsUI 框架:拥有 AddressBookUI 框架的所有功能,使用起来更加的面向对象.

随机推荐