源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

iOS10 App适配权限 Push Notifications 字体Frame 遇到的问题

  • 时间:2021-05-23 15:25 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:iOS10 App适配权限 Push Notifications 字体Frame 遇到的问题
[b]添加配置权限[/b]
<!-- 相册 -->
<key>NSPhotoLibraryUsageDescription</key>
<string>"xx"想使用您的相册,需要您的允许</string>
<!-- 相机 -->
<key>NSCameraUsageDescription</key>
<string>"xx"想使用您的相机,需要您的允许</string>
<!-- 麦克风 -->
<key>NSMicrophoneUsageDescription</key>
<string>"xx"想使用您的麦克风,需要您的允许</string>
<!-- 位置 -->
<key>NSLocationUsageDescription</key>
<string>"xx"想访问您的位置,请您允许</string>
<!-- 日历 -->
<key>NSCalendarsUsageDescription</key>
<string>"xx"想访问您的日历,请您允许</string>
<!-- 媒体资料库 -->
<key>NSAppleMusicUsageDescription</key>
<string>"xx"想访问您的媒体资料库,请您允许</string>
<!-- 蓝牙 -->
<key>NSBluetoothPeripheralUsageDescription</key>
<string>"xx"想访问您的蓝牙,请您允许</string>
<!--通讯录 -->
<key>NSContactsUsageDescription</key>
<string>"xx"想访问您的通讯录,请您允许</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>请点击“允许”。若不允许,您将无法正常使用“附近”的功能。</string>
[b]添加Push Notifications支持 [/b] [img]http://files.jb51.net/file_images/article/201609/2016092416095223.png[/img] 开关开启后会自动生成xxxx.entitlements文件 [img]http://files.jb51.net/file_images/article/201609/2016092416095224.png[/img] [img]http://files.jb51.net/file_images/article/201609/2016092416095225.png[/img] [b]这里需要注意几点[/b] 生成的该文件是否包含到你的打包工程中Bundle Resources中 如果没有手动添加进去 [img]http://files.jb51.net/file_images/article/201609/2016092416095226.png[/img] [img]http://files.jb51.net/file_images/article/201609/2016092416095227.png[/img] 如果工程有多个Target 且多个证书在一起建议不要使用 Automatically manage signing [img]http://files.jb51.net/file_images/article/201609/2016092416095228.png[/img] [b]采用下面的这种方法[/b] [img]http://files.jb51.net/file_images/article/201609/2016092416095229.png[/img] [b]总结[/b] 第一个 我们的项目是多个app时的所以在配置证书的时候要指定对应的证书,自动适配会适配不准确,因为我们的多个工程分多个target好多共用的工程。 第二个 就是生成的entitlements文件要包含到bundle中 [b]适配字体 [/b] ios中适配sb中的文本... 最好的办法就是手动变更frame 纯代码的页面可以在计算字体size的时候根据比例添加一些frame
+(CGSize)textFrameWithString:(NSString *)text width:(float)width fontSize:(NSInteger)fontSize
{
NSDictionary *dict = @{NSFontAttributeName: [UIFont systemFontOfSize:fontSize]};
// 根据第一个参数的文本内容,使用280*float最大值的大小,使用系统14号字,返回一个真实的frame size : (280*xxx)!!
CGRect frame = [text boundingRectWithSize:CGSizeMake(width, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:dict context:nil];
CGSize textSize = frame.size;
CGFloat scale = 17.5/17.0;
// iOS 10
if ([[UIDevice currentDevice].systemVersion floatValue] >= 10.0) {
textSize.width = textSize.width * scale;
textSize.height = textSize.height * scale;
}
return textSize;
}
以上所述是小编给大家介绍的iOS10 App适配权限 Push Notifications 字体Frame 遇到的问题,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对编程素材网网站的支持!
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部