FROM : I. Savant
DATE : Fri Apr 27 12:44:40 2007
On Apr 27, 2007, at 4:11 AM, Warwick Hall wrote:
> can someone please explain to me how to set a view's minimum
> required size (bounds) to display all its contents?
You'd have to write your own method to do this - usually named "-
sizeToFit" as in NSBox, NSControl, NSText, etc. If your view contains
subviews, then your "sizeToFit" method might iterate through them
all, using NSUnionRect() to keep adding up all their frames. Then you
can adjust your "container" view accordingly.
If you're doing custom drawing, etc. then you should already know
the metrics of all your graphical elements since you had to determine
where to draw them in the first place.
It entirely depends on what your view contains and how it's built.
Without further details, it's hard to make a solid suggestion.
--
I.S.
DATE : Fri Apr 27 12:44:40 2007
On Apr 27, 2007, at 4:11 AM, Warwick Hall wrote:
> can someone please explain to me how to set a view's minimum
> required size (bounds) to display all its contents?
You'd have to write your own method to do this - usually named "-
sizeToFit" as in NSBox, NSControl, NSText, etc. If your view contains
subviews, then your "sizeToFit" method might iterate through them
all, using NSUnionRect() to keep adding up all their frames. Then you
can adjust your "container" view accordingly.
If you're doing custom drawing, etc. then you should already know
the metrics of all your graphical elements since you had to determine
where to draw them in the first place.
It entirely depends on what your view contains and how it's built.
Without further details, it's hard to make a solid suggestion.
--
I.S.
| Related mails | Author | Date |
|---|---|---|
| Warwick Hall | Apr 27, 10:11 | |
| I. Savant | Apr 27, 12:44 | |
| Warwick Hall | Apr 28, 22:45 | |
| I. Savant | Apr 28, 22:49 | |
| Warwick Hall | Apr 29, 06:22 | |
| Shamyl Zakariya | Apr 30, 23:35 |






Cocoa mail archive

