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 width
CGSize sizeOneLineConstrained = [label.text sizeWithFont:label.font constrainedToSize:label.frame.size];
// Approximate scaling factor
CGFloat approxScaleFactor = sizeOneLineConstrained.width/sizeOneLine.width;
// Approximate new point size
CGFloat approxScaledPointSize = approxScaleFactor * label.font.pointSize;
直接ではなく、あなたがそれを計算することができます。最初の答えはこちら:http://stackoverflow.com/questions/3669844/how-to-get-uilabel-uitextview-auto-adjusted-font-size – savner
「UILabel」は私有財産の情報を持っているので迷惑です'_UILabelScaledMetrics'のインスタンスである' _scaledMetrics'と呼ばれるものです。そのクラスには '_actualScaleFactor'プロパティがあります。しかし、それは一般に公開されていないので学者全員。 – ChrisH