
任何想法如何在系统调整字体大小后获得真正的磅值?
解决方法 我不知道用于在缩小内容时获取UILabel的当前磅值的API.您可以尝试使用sizeWithFont API来近似“缩放因子”.只是一个想法:
// Get the size of the text with no scaling (one line)CGSize sizeOneline = [label.text sizeWithFont:label.Font];// Get the size of the text enforcing the scaling based on label wIDthCGSize sizeOnelineConstrained = [label.text sizeWithFont:label.Font constrainedToSize:label.frame.size];// Approximate scaling factorCGfloat approxScaleFactor = sizeOnelineConstrained.wIDth / sizeOneline.wIDth;// Approximate new point sizeCGfloat approxScaledPointSize = approxScaleFactor * label.Font.pointSize;总结
以上是内存溢出为你收集整理的ios – 在minimumFontSize之后获取UILabel字体全部内容,希望文章能够帮你解决ios – 在minimumFontSize之后获取UILabel字体所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)