Resizing issue
Resizing issue
- Subject: Resizing issue
- From: Steven Spencer <email@hidden>
- Date: Thu, 3 Jun 2004 19:30:35 +0100
Hello,
Can someone help with this resizing issue ?
In Interface Builder, I have a label textfield and a textview inside a
customview.
The label is at the top and the textview is immediately below it and
fills the remaining space.
The autosizing of the label is set so it remains at the top of the
customview.
(all the sizing lines are straight except for the right and bottom
anchor lines which are springy)
The autosizing of the textview's scrollview container is set to fill
remaining space.
(the object sizing lines are springy and the anchor lines are straight)
The custom view and a table view is inside a splitview.
Resizing of the textview works when adjusting the splitter until the
customview is collapsed and then expanded.
When this happens, the textview's height is no longer correct and it is
drawn beneath the label
from the top of the customview.
Is there a simple way to fix this ?
I have a solution (shown below), but I'm sure there's a better way.
Thanks for any input.
- Steve Spencer
Adjust the autosizing of the textview's scrollview container so it
remains at the bottom of the customview.
(the horizontal object sizing line is springy and the bottom anchor
line is springy.
All other sizing lines are straight).
Connect the textview's scrollview container to the outlet in the class
below.
Connect the window delegate to the class below.
-------------------------------------------------------------
/* szObj */
#import <Cocoa/Cocoa.h>
@interface szObj : NSObject
{
IBOutlet NSScrollView *myScrollView;
}
@end
-------------------------------------------------------------
#import "szObj.h"
@implementation szObj
float offsetFromViewTop;
- (void)frameChanged:(NSNotification *)aNotification
{
float newHeight = [[myScrollView superview] frame].size.height -
offsetFromViewTop;
if (newHeight > 0) {
[myScrollView setFrame:NSMakeRect(0,0,[myScrollView
frame].size.width, newHeight)];
[myScrollView setNeedsDisplay:YES];
}
}
- (void)awakeFromNib
{
offsetFromViewTop = [[myScrollView superview] frame].size.height -
[myScrollView frame].size.height;
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(frameChanged:)
name:NSViewFrameDidChangeNotification
object:[myScrollView superview]];
}
@end
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.