Instance Method インスタンスメソッド

sizeWithAttributes:

Returns the bounding box size the receiver occupies when drawn with the given attributes. 与えられた属性で描画される時に、レシーバが占める境界ボックスのサイズを返します。

Declaration 宣言

iOS, iPadOS, Mac Catalyst, tvOS, watchOS

- (CGSize)sizeWithAttributes:(NSDictionary<NSAttributedStringKey, id> *)attrs;

macOS

- (NSSize)sizeWithAttributes:(NSDictionary<NSAttributedStringKey, id> *)attrs;

Parameters パラメータ

attrs

A dictionary of text attributes to be applied to the string. These are the same attributes that can be applied to an NSAttributedString object, but in the case of NSString objects, the attributes apply to the entire string, rather than ranges within the string. 文字列に適用されることになるテキスト属性からなる辞書。NSAttributedStringオブジェクトに適用されることができるのと同じ属性があります、しかしNSStringオブジェクトの場合には、属性は文字列全体に適用されます、文字列内の範囲ではなく。

Return Value 戻り値

The bounding box size the receiver occupies when drawn with the specified attributes. 指定された属性で描画される場合にレシーバが占める境界ボックスサイズ。

Discussion 議論

This method returns fractional sizes; to use a returned size to size views, you must raise its value to the nearest higher integer using the ceil function. このメソッドは小数サイズを返します;返されるサイズを使ってビューをある大きさに作るには、あなたはそれの値を最も近いより高い整数にceil関数を使って持ち上げなければなりません。

See Also 参照

Sizing and Drawing Strings 文字列の大きさ指定と描画