【学习ios之路:UI系列】获取ios系统版本的相关操作. 及 将汉字转化为拼音功能实现

1.获取ios系统版本的相关操作

<span style="font-size:18px;">    //iOS系统版本//系统版本,如6.2.1
    NSString *systemVersion = [[UIDevice currentDevice] systemVersion];
    NSLog(@"systemVersion = %@", systemVersion);
    
    //获取系统名称,如iPhone OS
    NSString *systemName = [[UIDevice currentDevice] systemName];
    NSLog(@"systemName = %@", systemName);
    
    //The model of the device,如iPhone或者iPod touch
    NSString *systemModel = [[UIDevice currentDevice] model];
    NSLog(@"systemModel = %@", systemModel);

    //设备的惟一标识号,deviceID
    //[[UIDevice currentDevice] userInterfaceIdiom];
    NSLog(@"%ld", [[UIDevice currentDevice] userInterfaceIdiom]);
    //设备的名称,如 张三的iPhone
    NSString *userName = [[UIDevice currentDevice] name];
    NSLog(@"userName = %@", userName);
    
    //The model of the device as a localized string,类似model
    NSString *systemLocalizedModel = [[UIDevice currentDevice] localizedModel];
    NSLog(@"systemLocalizedModel = %@", systemLocalizedModel);
</span>
2.将汉字转化为拼音,处理操作如下
<span style="font-size:18px;">NSMutableString *letter = [@"你大爷" mutableCopy];
CFStringTransform((__bridge CFMutableStringRef)letter, 0,
                                                kCFStringTransformMandarinLatin, NO);
CFStringTransform((__bridge CFMutableStringRef)letter,0,
                                              kCFStringTransformStripDiacritics, NO);
   
 NSLog(@"%@",letter);// 结果  ni  da  ye</span>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值