ScreenSaverView does not get resized
ScreenSaverView does not get resized
- Subject: ScreenSaverView does not get resized
- From: Gabriel Zachmann via Cocoa-dev <email@hidden>
- Date: Tue, 10 Mar 2020 22:48:02 +0100
I have a ScreenSaverView instantiated and added to a window of a stand-alone
app like this:
In MasterViewController:
- (void) viewDidLoad
{
[super viewDidLoad];
saver_ = [[ArtSaverView alloc] initWithFrame: self.view.frame isPreview: NO
];
[self.view addSubview: saver_];
[saver_ setTranslatesAutoresizingMaskIntoConstraints: NO];
NSLayoutConstraint *left = [NSLayoutConstraint constraintWithItem: saver_
attribute: NSLayoutAttributeLeft
relatedBy:
NSLayoutRelationEqual toItem: self.view
attribute:
NSLayoutAttributeLeft multiplier: 1.0 constant: 0.0];
NSLayoutConstraint *right = [NSLayoutConstraint constraintWithItem: saver_
attribute: NSLayoutAttributeRight
relatedBy:
NSLayoutRelationEqual toItem: self.view
attribute:
NSLayoutAttributeRight multiplier: 1.0 constant: 0.0];
NSLayoutConstraint *top = [NSLayoutConstraint constraintWithItem: saver_
attribute: NSLayoutAttributeTop
relatedBy:
NSLayoutRelationEqual toItem: self.view
attribute:
NSLayoutAttributeTop multiplier: 1.0 constant: 0.0];
NSLayoutConstraint *bottom = [NSLayoutConstraint constraintWithItem: saver_
attribute: NSLayoutAttributeBottom
relatedBy:
NSLayoutRelationEqual toItem: self.view
attribute:
NSLayoutAttributeBottom multiplier: 1.0 constant: 0.0];
[self.view addConstraints: @[left, right, top, bottom] ];
// ...
}
ArtSaverView is declared like this:
@interface ArtSaverView : ScreenSaverView <NSTextViewDelegate,
CALayerDelegate, CAAnimationDelegate>
The animation works fine.
Also, the MasterViewController's view has autoresizesSubviews = true, AFAICS,
...
However, when I resize the window (using the mouse),
the screensaverview does not get resized.
The area around the original view just remains grey and the frame of the
screensaver view keeps its original value.
I have checked that -viewDidEndLiveResize does get called.
But the view's new frame is still the old one.
I must be missing something, please advise.
Thanks a lot in advance.
Gab.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden