hi all,
i have four custom views i want to display but i only ever want to display three of them at the same time in a split view (and i learned that we can't display the same view twice... go figure)
what i did was i made a horizontal pane with three scroll panes inside. After playing around with the measurements i got the pane view to resize everything properly so that nothing would become distorted and still fill the whole pane in the split view
i had to make a class for the three custom views inside the scroll panes and all they do is make sure they flip so that the scroll pane starts at the top
and they have the ability to change their subview (because the scrollpane wont let me change it's subview, it gives runtime errors)
when the main program calls awakeFromNib it assigns one of the four custom views as a subview of the custom view inside the scroll pane
at this point there is a lot of distortion and squashing of the four custom views
not only that but the four custom views stay the same width and height when the window is resized (even though it was set to take up all the space in IB?)
and when the method is called to change the subviews the four custom views are the correct size (but they still don't take up the space they are meant to)
i'm fairly certian i'm doing EVERYTHING wrong because that's just mega-complicated
and i think it's weird that calling this method:
from awakeFromNib results in squashed up subviews and then calling it again makes it show the subviews properly-ish
surely changing the subviews of a scrollview isn't this complex....
and just so you know setContentView also didn't work
for some bizzare reason as soon as i hook a scrollview to a class the program instantly thinks its just a regular NSView even though the class inherits NSSrollView
nevermind
i think i found a suitable hax for it
instead of trying to change the scroll view's custom view's subview (jezz, it still sounds overly complex for such a simple task)
i'm changing the splitview's subviews
and it seems i was able to guess the correct measurements to make a subview to appear correctly
although it's very elegant having to make an array each time i want to change the views
i have four custom views i want to display but i only ever want to display three of them at the same time in a split view (and i learned that we can't display the same view twice... go figure)
what i did was i made a horizontal pane with three scroll panes inside. After playing around with the measurements i got the pane view to resize everything properly so that nothing would become distorted and still fill the whole pane in the split view
i had to make a class for the three custom views inside the scroll panes and all they do is make sure they flip so that the scroll pane starts at the top
and they have the ability to change their subview (because the scrollpane wont let me change it's subview, it gives runtime errors)
when the main program calls awakeFromNib it assigns one of the four custom views as a subview of the custom view inside the scroll pane
at this point there is a lot of distortion and squashing of the four custom views
not only that but the four custom views stay the same width and height when the window is resized (even though it was set to take up all the space in IB?)
and when the method is called to change the subviews the four custom views are the correct size (but they still don't take up the space they are meant to)
i'm fairly certian i'm doing EVERYTHING wrong because that's just mega-complicated
and i think it's weird that calling this method:
Code:
- (void)changeSubView: (NSView*)newView {
NSArray* viewSet = [NSArray arrayWithObject: newView];
[self setSubviews: viewSet];
[self setBounds: [newView bounds]];
[self setFrame: [newView frame]];
[self setNeedsDisplay: YES];
}
surely changing the subviews of a scrollview isn't this complex....
and just so you know setContentView also didn't work
for some bizzare reason as soon as i hook a scrollview to a class the program instantly thinks its just a regular NSView even though the class inherits NSSrollView
*** -[NSView setContentView:]: unrecognized selector sent to instance 0x138460
NSInvalidArgumentException *** -[NSView setContentView:]: unrecognized selector sent to instance 0x138460
nevermind
i think i found a suitable hax for it
instead of trying to change the scroll view's custom view's subview (jezz, it still sounds overly complex for such a simple task)
i'm changing the splitview's subviews
and it seems i was able to guess the correct measurements to make a subview to appear correctly
although it's very elegant having to make an array each time i want to change the views