I inherited MyView class from NSView. In a controllers init method I am creating a panel
Later in one of the methods I am setting the title, icon and text as follows
Its working fine upto this point. But my problem is that if title is more than the width of panel ie 270 pixels or if text height more than 65 pixels, the text is crossing the border and not able to view it. No scroll bars are to be there in that. It's a restriction.
So, I want to increase the size of view & panel dynamically depending on width and height of the text. What's the procedure to achieve this.
Code:
NSPanel *panel = [[[NSPanel alloc] initWithContentRect:NSMakeRect( 0., 0., 270., 65. )
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered defer:NO] autorelease];
.
.
.
.
MyView *view = [[[KABubbleWindowView alloc] initWithFrame:[panel frame]] autorelease];
[view setTarget:self];
[view setAction:@selector( _bubbleClicked: )];
[panel setContentView:view];
.
.
.
.
return ( self = [super initWithWindow:panel] );
Later in one of the methods I am setting the title, icon and text as follows
Code:
id ret = [[[self alloc] init] autorelease];
[ret setTitle:title];
if( [text isKindOfClass:[NSString class]] ) [ret setText:text];
else if( [text isKindOfClass:[NSAttributedString class]] ) [ret setAttributedText:text];
[ret setIcon:icon];
return ret;
So, I want to increase the size of view & panel dynamically depending on width and height of the text. What's the procedure to achieve this.