Muruganandham K
Muruganandham K

Reputation: 5331

NSView subView not visible after added to superView

this is my final window enter image description here

i added 4 subviews (last 4 in 2nd image) to the base view. but not displaying the view. after manual resizing window the subviews appeared as below. enter image description here

how can fix it?

Upvotes: 0

Views: 1977

Answers (2)

geowar
geowar

Reputation: 4447

baseView.needsDisplay = YES;

-- or --

subview.superview.needsDisplay = YES;

Upvotes: 2

stosha
stosha

Reputation: 2148

You can use NSScrollView:

    NSScrollView* scrollView = [[NSScrollView alloc] init];
    [scrollView setHasHorizontalScroller: YES];
    [scrollView setHasVerticalScroller: YES];
    self.contentView = [[NSView alloc] initWithFrame: NSMakeRect(0, 0, 1.0e7, 1.0e7)];
    [self.contentView addSubview: [NSImageView ...]];        
    [self.contentView addSubview: [NSImageView ...]];        
    ...
    [scrollView setDocumentView: self.contentView];
    self.view = scrollView;

Or use Minimum Size for Window.

Upvotes: 0

Related Questions