-( float )getLabelHeight:( NSString *)str andFont:( CGFloat )font andWidth:( float )width
{
if ([[[ UIDevice currentDevice ] systemVersion ] floatValue ] < 7 ) // iOS 7より前に適応
{
// UIFont *font = [UIFont systemFontOfSize:font];
CGSize maxSize= CGSizeMake (幅, MAXFLOAT );
CGSizeサイズ = [str sizeWithFont :[ UIFont systemFontOfSize :font] constrainedToSize :maxSize lineBreakMode : UILineBreakModeWordWrap ];
返品 サイズ。高さ;
}
それ以外
{
NSDictionary *dic= @{ NSFontAttributeName :[ UIFont systemFontOfSize :font] } ;
CGSize maxSize= CGSizeMake (幅, MAXFLOAT );
CGRect rect=[ strboundingRectWithSize :maxSizeオプション: NSStringDrawingUsesLineFragmentOrigin 属性:dic context : nil ];
直角を返します。サイズも 高さ;
}
}