CustomView *customView = [[CustomView alloc] init];
[self.window.contentView addSubview:customView];
How can i make customView.frame.size.height
always equals to contentView.frame.size.height
when the window resize , and at the same time customView.frame.size.width = 20;
?
Swift version, to apply autoresizingMask:
let customView = CustomView()
customView.autoresizingMask = [.width, .height]
self.window.contentView.addSubview(customView)
ref to options
Set the custom view's autoresizingMask:
CustomView *customView = [[CustomView alloc] init];
customView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
[self.window.contentView addSubview:customView];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With