resizeWithOldSuperviewSize not getting called on added Subview


Dave
 

Hi,

I’m using Manual Layout on a Mac project. The View Hierarchy is built in Interface Builder and during run time I add a subview to one of the views. However, resizeWithOldSuperviewSize is not being called on these subviews. The subview in question is a subclass of NSImageView.

I’ve explicitly set autoresizesSubviews = YES in the view that adds the subview (actually is all the views in the Hierarchy).

Anyone have half an idea why resizeWithOldSuperviewSize is not being called? The frame of the parent rectangle is definitely being set…..

All the Best
Dave


Dave
 

This is a Mac Project.

I’ve not found anything obvious on this, so I’m trying to get to the bottom of why the auto-resizing mechanism is not working with Class that inherits from NSImageView called GameImageView. An object is created and added to the view hierarchy at run time.

The view hierarchy is actually setup in a Storyboard/NIB and looks something like this:

WindowTrackerView
GameBaseView
TopAreaView
BottomAreaView
LeftAreaView
RightAreaView
GameBoardView
GameClusterView1
GameCellView1
GameCellView2
GameCellViewN
GameClusterView2
GameCellView1
GameCellView2
GameCellViewN
GameClusterViewN
GameCellView1
GameCellView2
GameCellViewN


I am adding GameImageView to each of the GameCellView's at runtime. All the Views are now using resizeWithOldSuperviewSize to resize themselves and it works wonderfully EXCEPT then this mechanism is not working on the run-time added GameImageView’s, e.g. GameImageView ::resizeWithOldSuperviewSize never gets called, although it does get called in the GameCellView’s.

If I do this in the GameCellView:: resizeWithOldSuperviewSize method it works ok (e.g. the Image resized when I resize the window):

myCellStartPosition = [self getCellXYPosition];

myBoundingRect = self.superview.bounds;
myFrameRect = [self calculateFrameRectWithSuperViewRect:myBoundingRect];

myFrameRect.origin.x = (int) (3 + (myCellStartPosition.x * (myFrameRect.size.width + 2)));
myFrameRect.origin.y = (int) (3 + (myCellStartPosition.y * (myFrameRect.size.height + 2)));

self.frame = myFrameRect;

//**
//** Setup the Image View Frame based on the Cell’s view *********************
//**
myImageFrameRect = NSInsetRect(self.bounds,2,2);
self.pCellImageView.frame = myImageFrameRect;

e.g. if I set the the frame of the GameImageView in the Superclass it works ok. If I don’t do this expecting GameCellView:: resizeWithOldSuperviewSize to be called then the image does NOT resize, since it isn’t called!! I’m trying to understand why this doesn’t work as expected, I’m not doing anything different (apart from adding it as a subview at runtime) from the other classes in the hierarchy and they all work wonderfully.

I’ve more or less got it working, but this last part is driving me nuts, so if anyone can shed some light on what could be going wrong I’m be really grateful.

Thanks in advance.

All the Best
Dave

On 27 Sep 2018, at 20:10, Dave <dave@looktowindward.com> wrote:

Hi,

I’m using Manual Layout on a Mac project. The View Hierarchy is built in Interface Builder and during run time I add a subview to one of the views. However, resizeWithOldSuperviewSize is not being called on these subviews. The subview in question is a subclass of NSImageView.

I’ve explicitly set autoresizesSubviews = YES in the view that adds the subview (actually is all the views in the Hierarchy).

Anyone have half an idea why resizeWithOldSuperviewSize is not being called? The frame of the parent rectangle is definitely being set…..

All the Best
Dave







Dave
 

Hi Again,

After digging around a little I find this:

https://lists.apple.com/archives/cocoa-dev///2005/Oct/msg00476.html

It seems that someone else has noticed this way back in 2005! From looking at the article, it mentions:

-(void) viewDidEndLiveResize

While I added to the GameImageView class and it does get called, I’m not sure if I can use it or not, but I’d really, really, really like to know if resizeWithOldSuperviewSize is a known bug or if I’m doing something wrong?

All the Best
Dave

On 28 Sep 2018, at 12:34, Dave <dave@looktowindward.com> wrote:

This is a Mac Project.

I’ve not found anything obvious on this, so I’m trying to get to the bottom of why the auto-resizing mechanism is not working with Class that inherits from NSImageView called GameImageView. An object is created and added to the view hierarchy at run time.

The view hierarchy is actually setup in a Storyboard/NIB and looks something like this:

WindowTrackerView
GameBaseView
TopAreaView
BottomAreaView
LeftAreaView
RightAreaView
GameBoardView
GameClusterView1
GameCellView1
GameCellView2
GameCellViewN
GameClusterView2
GameCellView1
GameCellView2
GameCellViewN
GameClusterViewN
GameCellView1
GameCellView2
GameCellViewN


I am adding GameImageView to each of the GameCellView's at runtime. All the Views are now using resizeWithOldSuperviewSize to resize themselves and it works wonderfully EXCEPT then this mechanism is not working on the run-time added GameImageView’s, e.g. GameImageView ::resizeWithOldSuperviewSize never gets called, although it does get called in the GameCellView’s.

If I do this in the GameCellView:: resizeWithOldSuperviewSize method it works ok (e.g. the Image resized when I resize the window):

myCellStartPosition = [self getCellXYPosition];

myBoundingRect = self.superview.bounds;
myFrameRect = [self calculateFrameRectWithSuperViewRect:myBoundingRect];

myFrameRect.origin.x = (int) (3 + (myCellStartPosition.x * (myFrameRect.size.width + 2)));
myFrameRect.origin.y = (int) (3 + (myCellStartPosition.y * (myFrameRect.size.height + 2)));

self.frame = myFrameRect;

//**
//** Setup the Image View Frame based on the Cell’s view *********************
//**
myImageFrameRect = NSInsetRect(self.bounds,2,2);
self.pCellImageView.frame = myImageFrameRect;

e.g. if I set the the frame of the GameImageView in the Superclass it works ok. If I don’t do this expecting GameCellView:: resizeWithOldSuperviewSize to be called then the image does NOT resize, since it isn’t called!! I’m trying to understand why this doesn’t work as expected, I’m not doing anything different (apart from adding it as a subview at runtime) from the other classes in the hierarchy and they all work wonderfully.

I’ve more or less got it working, but this last part is driving me nuts, so if anyone can shed some light on what could be going wrong I’m be really grateful.

Thanks in advance.

All the Best
Dave


On 27 Sep 2018, at 20:10, Dave <dave@looktowindward.com> wrote:

Hi,

I’m using Manual Layout on a Mac project. The View Hierarchy is built in Interface Builder and during run time I add a subview to one of the views. However, resizeWithOldSuperviewSize is not being called on these subviews. The subview in question is a subclass of NSImageView.

I’ve explicitly set autoresizesSubviews = YES in the view that adds the subview (actually is all the views in the Hierarchy).

Anyone have half an idea why resizeWithOldSuperviewSize is not being called? The frame of the parent rectangle is definitely being set…..

All the Best
Dave








Dave
 

I did the resizing in the viewDidEndLiveResize method and it does resize correctly, but the problem is that the image stays at the old size until the User stops re-sizing the window (e.g. mouseUp’s) and then it resizes them, which won’t do!

I’ll keep digging!

On 28 Sep 2018, at 19:15, Dave <dave@...> wrote:

Hi Again,

After digging around a little I find this:

https://lists.apple.com/archives/cocoa-dev///2005/Oct/msg00476.html

It seems that someone else has noticed this way back in 2005! From looking at the article, it mentions:

-(void) viewDidEndLiveResize

While I added to the GameImageView class and it does get called, I’m not sure if I can use it or not, but I’d really, really, really like to know if resizeWithOldSuperviewSize is a known bug or if I’m doing something wrong?

All the Best
Dave

On 28 Sep 2018, at 12:34, Dave <dave@...> wrote:

This is a Mac Project.

I’ve not found anything obvious on this, so I’m trying to get to the bottom of why the auto-resizing mechanism is not working with Class that inherits from NSImageView called GameImageView. An object is created and added to the view hierarchy at run time.

The view hierarchy is actually setup in a Storyboard/NIB and looks something like this:

WindowTrackerView
GameBaseView
TopAreaView
BottomAreaView
LeftAreaView
RightAreaView
GameBoardView
GameClusterView1
GameCellView1
GameCellView2
GameCellViewN
GameClusterView2
GameCellView1
GameCellView2
GameCellViewN
GameClusterViewN
GameCellView1
GameCellView2
GameCellViewN


I am adding  GameImageView to each of the GameCellView's at runtime. All the Views are now using resizeWithOldSuperviewSize to resize themselves and it works wonderfully EXCEPT then this mechanism is not working on the run-time added GameImageView’s, e.g. GameImageView ::resizeWithOldSuperviewSize never gets called, although it does get called in the GameCellView’s.

If I do this in the GameCellView:: resizeWithOldSuperviewSize method it works ok (e.g. the Image resized when I resize the window):

myCellStartPosition = [self getCellXYPosition];

myBoundingRect = self.superview.bounds;
myFrameRect = [self calculateFrameRectWithSuperViewRect:myBoundingRect];

myFrameRect.origin.x = (int) (3 + (myCellStartPosition.x * (myFrameRect.size.width + 2)));
myFrameRect.origin.y = (int) (3 + (myCellStartPosition.y * (myFrameRect.size.height + 2)));

self.frame = myFrameRect;

//**
//**  Setup the Image View Frame based on the Cell’s view   *********************
//**
myImageFrameRect = NSInsetRect(self.bounds,2,2);
self.pCellImageView.frame = myImageFrameRect;

e.g. if I set the the frame of the GameImageView in the Superclass it works ok. If I don’t do this expecting GameCellView:: resizeWithOldSuperviewSize to be called then the image does NOT resize, since it isn’t called!! I’m trying to understand why this doesn’t work as expected, I’m not doing anything different (apart from adding it as a subview at runtime) from the other classes in the hierarchy and they all work wonderfully.

I’ve more or less got it working, but this last part is driving me nuts, so if anyone can shed some light on what could be going wrong I’m be really grateful.

Thanks in advance.

All the Best
Dave


On 27 Sep 2018, at 20:10, Dave <dave@...> wrote:

Hi,

I’m using Manual Layout on a Mac project. The View Hierarchy is built in Interface Builder and during run time I add a subview to one of the views. However, resizeWithOldSuperviewSize is not being called on these subviews. The subview in question is a subclass of NSImageView. 

I’ve explicitly set autoresizesSubviews = YES in the view that adds the subview (actually is all the views in the Hierarchy).

Anyone have half an idea why resizeWithOldSuperviewSize is not being called? The frame of the parent rectangle is definitely being set…..

All the Best
Dave














Dave
 

Ahhhh, found something interesting:

self.translatesAutoresizingMaskIntoConstraints = NO;

Then resizeWithOldSuperviewSize gets called!!! BUT the image no longer resizes inside the Image View. Is there a way I can so this manually?

All the Best
Dave

On 28 Sep 2018, at 19:21, Dave <dave@looktowindward.com> wrote:

I did the resizing in the viewDidEndLiveResize method and it does resize correctly, but the problem is that the image stays at the old size until the User stops re-sizing the window (e.g. mouseUp’s) and then it resizes them, which won’t do!

I’ll keep digging!

On 28 Sep 2018, at 19:15, Dave <dave@looktowindward.com> wrote:

Hi Again,

After digging around a little I find this:

https://lists.apple.com/archives/cocoa-dev///2005/Oct/msg00476.html

It seems that someone else has noticed this way back in 2005! From looking at the article, it mentions:

-(void) viewDidEndLiveResize

While I added to the GameImageView class and it does get called, I’m not sure if I can use it or not, but I’d really, really, really like to know if resizeWithOldSuperviewSize is a known bug or if I’m doing something wrong?

All the Best
Dave

On 28 Sep 2018, at 12:34, Dave <dave@looktowindward.com> wrote:

This is a Mac Project.

I’ve not found anything obvious on this, so I’m trying to get to the bottom of why the auto-resizing mechanism is not working with Class that inherits from NSImageView called GameImageView. An object is created and added to the view hierarchy at run time.

The view hierarchy is actually setup in a Storyboard/NIB and looks something like this:

WindowTrackerView
GameBaseView
TopAreaView
BottomAreaView
LeftAreaView
RightAreaView
GameBoardView
GameClusterView1
GameCellView1
GameCellView2
GameCellViewN
GameClusterView2
GameCellView1
GameCellView2
GameCellViewN
GameClusterViewN
GameCellView1
GameCellView2
GameCellViewN


I am adding GameImageView to each of the GameCellView's at runtime. All the Views are now using resizeWithOldSuperviewSize to resize themselves and it works wonderfully EXCEPT then this mechanism is not working on the run-time added GameImageView’s, e.g. GameImageView ::resizeWithOldSuperviewSize never gets called, although it does get called in the GameCellView’s.

If I do this in the GameCellView:: resizeWithOldSuperviewSize method it works ok (e.g. the Image resized when I resize the window):

myCellStartPosition = [self getCellXYPosition];

myBoundingRect = self.superview.bounds;
myFrameRect = [self calculateFrameRectWithSuperViewRect:myBoundingRect];

myFrameRect.origin.x = (int) (3 + (myCellStartPosition.x * (myFrameRect.size.width + 2)));
myFrameRect.origin.y = (int) (3 + (myCellStartPosition.y * (myFrameRect.size.height + 2)));

self.frame = myFrameRect;

//**
//** Setup the Image View Frame based on the Cell’s view *********************
//**
myImageFrameRect = NSInsetRect(self.bounds,2,2);
self.pCellImageView.frame = myImageFrameRect;

e.g. if I set the the frame of the GameImageView in the Superclass it works ok. If I don’t do this expecting GameCellView:: resizeWithOldSuperviewSize to be called then the image does NOT resize, since it isn’t called!! I’m trying to understand why this doesn’t work as expected, I’m not doing anything different (apart from adding it as a subview at runtime) from the other classes in the hierarchy and they all work wonderfully.

I’ve more or less got it working, but this last part is driving me nuts, so if anyone can shed some light on what could be going wrong I’m be really grateful.

Thanks in advance.

All the Best
Dave


On 27 Sep 2018, at 20:10, Dave <dave@looktowindward.com> wrote:

Hi,

I’m using Manual Layout on a Mac project. The View Hierarchy is built in Interface Builder and during run time I add a subview to one of the views. However, resizeWithOldSuperviewSize is not being called on these subviews. The subview in question is a subclass of NSImageView.

I’ve explicitly set autoresizesSubviews = YES in the view that adds the subview (actually is all the views in the Hierarchy).

Anyone have half an idea why resizeWithOldSuperviewSize is not being called? The frame of the parent rectangle is definitely being set…..

All the Best
Dave








Dave
 

Hi,

This makes it work:

-(NSImage*) resizeImage:(NSImage*) theImage withImageRect:(NSRect) theImageRect
{
CGImageRef myCGImageRef;
NSImage* myImage;

myCGImageRef = [theImage CGImageForProposedRect:&theImageRect context:NULL hints:nil];
myImage = [[NSImage alloc] initWithCGImage:myCGImageRef size:theImageRect.size];
self.image = myImage;

return myImage;
}


-(void) layoutViewWithOldSuperviewSize:(NSSize) theOldSuperViewSize
{
NSRect myBoundingRect;
NSRect myFrameRect;
NSImage* myImage;

myBoundingRect = self.superview.bounds;
myFrameRect = NSInsetRect(myBoundingRect,2,2);
myImage = [self resizeImage:self.image withImageRect:myFrameRect];
self.image = myImage;

self.frame = myFrameRect;
}



-(void) resizeWithOldSuperviewSize:(NSSize) theOldSuperViewSize
{
[super resizeWithOldSuperviewSize:theOldSuperViewSize];

[self layoutViewWithOldSuperviewSize:theOldSuperViewSize];
}

Also you need:

self.translatesAutoresizingMaskIntoConstraints = NO;

Somewhere in the initialisation.


Hope this helps someone along the way.

If anyone know of a better/faster solution then please let me know!

All the Best
Dave

On 28 Sep 2018, at 19:31, Dave <dave@looktowindward.com> wrote:

Ahhhh, found something interesting:

self.translatesAutoresizingMaskIntoConstraints = NO;

Then resizeWithOldSuperviewSize gets called!!! BUT the image no longer resizes inside the Image View. Is there a way I can so this manually?

All the Best
Dave


On 28 Sep 2018, at 19:21, Dave <dave@looktowindward.com> wrote:

I did the resizing in the viewDidEndLiveResize method and it does resize correctly, but the problem is that the image stays at the old size until the User stops re-sizing the window (e.g. mouseUp’s) and then it resizes them, which won’t do!

I’ll keep digging!

On 28 Sep 2018, at 19:15, Dave <dave@looktowindward.com> wrote:

Hi Again,

After digging around a little I find this:

https://lists.apple.com/archives/cocoa-dev///2005/Oct/msg00476.html

It seems that someone else has noticed this way back in 2005! From looking at the article, it mentions:

-(void) viewDidEndLiveResize

While I added to the GameImageView class and it does get called, I’m not sure if I can use it or not, but I’d really, really, really like to know if resizeWithOldSuperviewSize is a known bug or if I’m doing something wrong?

All the Best
Dave

On 28 Sep 2018, at 12:34, Dave <dave@looktowindward.com> wrote:

This is a Mac Project.

I’ve not found anything obvious on this, so I’m trying to get to the bottom of why the auto-resizing mechanism is not working with Class that inherits from NSImageView called GameImageView. An object is created and added to the view hierarchy at run time.

The view hierarchy is actually setup in a Storyboard/NIB and looks something like this:

WindowTrackerView
GameBaseView
TopAreaView
BottomAreaView
LeftAreaView
RightAreaView
GameBoardView
GameClusterView1
GameCellView1
GameCellView2
GameCellViewN
GameClusterView2
GameCellView1
GameCellView2
GameCellViewN
GameClusterViewN
GameCellView1
GameCellView2
GameCellViewN


I am adding GameImageView to each of the GameCellView's at runtime. All the Views are now using resizeWithOldSuperviewSize to resize themselves and it works wonderfully EXCEPT then this mechanism is not working on the run-time added GameImageView’s, e.g. GameImageView ::resizeWithOldSuperviewSize never gets called, although it does get called in the GameCellView’s.

If I do this in the GameCellView:: resizeWithOldSuperviewSize method it works ok (e.g. the Image resized when I resize the window):

myCellStartPosition = [self getCellXYPosition];

myBoundingRect = self.superview.bounds;
myFrameRect = [self calculateFrameRectWithSuperViewRect:myBoundingRect];

myFrameRect.origin.x = (int) (3 + (myCellStartPosition.x * (myFrameRect.size.width + 2)));
myFrameRect.origin.y = (int) (3 + (myCellStartPosition.y * (myFrameRect.size.height + 2)));

self.frame = myFrameRect;

//**
//** Setup the Image View Frame based on the Cell’s view *********************
//**
myImageFrameRect = NSInsetRect(self.bounds,2,2);
self.pCellImageView.frame = myImageFrameRect;

e.g. if I set the the frame of the GameImageView in the Superclass it works ok. If I don’t do this expecting GameCellView:: resizeWithOldSuperviewSize to be called then the image does NOT resize, since it isn’t called!! I’m trying to understand why this doesn’t work as expected, I’m not doing anything different (apart from adding it as a subview at runtime) from the other classes in the hierarchy and they all work wonderfully.

I’ve more or less got it working, but this last part is driving me nuts, so if anyone can shed some light on what could be going wrong I’m be really grateful.

Thanks in advance.

All the Best
Dave


On 27 Sep 2018, at 20:10, Dave <dave@looktowindward.com> wrote:

Hi,

I’m using Manual Layout on a Mac project. The View Hierarchy is built in Interface Builder and during run time I add a subview to one of the views. However, resizeWithOldSuperviewSize is not being called on these subviews. The subview in question is a subclass of NSImageView.

I’ve explicitly set autoresizesSubviews = YES in the view that adds the subview (actually is all the views in the Hierarchy).

Anyone have half an idea why resizeWithOldSuperviewSize is not being called? The frame of the parent rectangle is definitely being set…..

All the Best
Dave









Dave
 

There is a problem wit the way this is coded that means that the same image is being resized up and down which isn’t the best. I’ve changed it to load all the images ahead of time and always resize from the original full size image…...

On 28 Sep 2018, at 20:21, Dave <dave@...> wrote:

Hi,

This makes it work:

-(NSImage*) resizeImage:(NSImage*) theImage withImageRect:(NSRect) theImageRect
{
CGImageRef myCGImageRef;
NSImage* myImage;

myCGImageRef = [theImage CGImageForProposedRect:&theImageRect context:NULL hints:nil];
myImage = [[NSImage alloc] initWithCGImage:myCGImageRef size:theImageRect.size];
self.image = myImage;

return myImage;
}


-(void) layoutViewWithOldSuperviewSize:(NSSize) theOldSuperViewSize
{
NSRect myBoundingRect;
NSRect myFrameRect;
NSImage* myImage;

myBoundingRect = self.superview.bounds;
myFrameRect = NSInsetRect(myBoundingRect,2,2);
myImage = [self resizeImage:self.image withImageRect:myFrameRect];
self.image = myImage;

self.frame = myFrameRect;
}



-(void) resizeWithOldSuperviewSize:(NSSize) theOldSuperViewSize
{
[super resizeWithOldSuperviewSize:theOldSuperViewSize];

[self layoutViewWithOldSuperviewSize:theOldSuperViewSize];
}

Also you need:

self.translatesAutoresizingMaskIntoConstraints = NO;

Somewhere in the initialisation.


Hope this helps someone along the way.

If anyone know of a better/faster solution then please let me know!

All the Best
Dave


On 28 Sep 2018, at 19:31, Dave <dave@...> wrote:

Ahhhh, found something interesting:

self.translatesAutoresizingMaskIntoConstraints = NO;

Then resizeWithOldSuperviewSize gets called!!! BUT the image no longer resizes inside the Image View. Is there a way I can so this manually?

All the Best
Dave


On 28 Sep 2018, at 19:21, Dave <dave@...> wrote:

I did the resizing in the viewDidEndLiveResize method and it does resize correctly, but the problem is that the image stays at the old size until the User stops re-sizing the window (e.g. mouseUp’s) and then it resizes them, which won’t do!

I’ll keep digging!

On 28 Sep 2018, at 19:15, Dave <dave@...> wrote:

Hi Again,

After digging around a little I find this:

https://lists.apple.com/archives/cocoa-dev///2005/Oct/msg00476.html

It seems that someone else has noticed this way back in 2005! From looking at the article, it mentions:

-(void) viewDidEndLiveResize

While I added to the GameImageView class and it does get called, I’m not sure if I can use it or not, but I’d really, really, really like to know if resizeWithOldSuperviewSize is a known bug or if I’m doing something wrong?

All the Best
Dave

On 28 Sep 2018, at 12:34, Dave <dave@...> wrote:

This is a Mac Project.

I’ve not found anything obvious on this, so I’m trying to get to the bottom of why the auto-resizing mechanism is not working with Class that inherits from NSImageView called GameImageView. An object is created and added to the view hierarchy at run time.

The view hierarchy is actually setup in a Storyboard/NIB and looks something like this:

WindowTrackerView
GameBaseView
TopAreaView
BottomAreaView
LeftAreaView
RightAreaView
GameBoardView
GameClusterView1
GameCellView1
GameCellView2
GameCellViewN
GameClusterView2
GameCellView1
GameCellView2
GameCellViewN
GameClusterViewN
GameCellView1
GameCellView2
GameCellViewN


I am adding  GameImageView to each of the GameCellView's at runtime. All the Views are now using resizeWithOldSuperviewSize to resize themselves and it works wonderfully EXCEPT then this mechanism is not working on the run-time added GameImageView’s, e.g. GameImageView ::resizeWithOldSuperviewSize never gets called, although it does get called in the GameCellView’s.

If I do this in the GameCellView:: resizeWithOldSuperviewSize method it works ok (e.g. the Image resized when I resize the window):

myCellStartPosition = [self getCellXYPosition];

myBoundingRect = self.superview.bounds;
myFrameRect = [self calculateFrameRectWithSuperViewRect:myBoundingRect];

myFrameRect.origin.x = (int) (3 + (myCellStartPosition.x * (myFrameRect.size.width + 2)));
myFrameRect.origin.y = (int) (3 + (myCellStartPosition.y * (myFrameRect.size.height + 2)));

self.frame = myFrameRect;

//**
//**  Setup the Image View Frame based on the Cell’s view   *********************
//**
myImageFrameRect = NSInsetRect(self.bounds,2,2);
self.pCellImageView.frame = myImageFrameRect;

e.g. if I set the the frame of the GameImageView in the Superclass it works ok. If I don’t do this expecting GameCellView:: resizeWithOldSuperviewSize to be called then the image does NOT resize, since it isn’t called!! I’m trying to understand why this doesn’t work as expected, I’m not doing anything different (apart from adding it as a subview at runtime) from the other classes in the hierarchy and they all work wonderfully.

I’ve more or less got it working, but this last part is driving me nuts, so if anyone can shed some light on what could be going wrong I’m be really grateful.

Thanks in advance.

All the Best
Dave


On 27 Sep 2018, at 20:10, Dave <dave@...> wrote:

Hi,

I’m using Manual Layout on a Mac project. The View Hierarchy is built in Interface Builder and during run time I add a subview to one of the views. However, resizeWithOldSuperviewSize is not being called on these subviews. The subview in question is a subclass of NSImageView. 

I’ve explicitly set autoresizesSubviews = YES in the view that adds the subview (actually is all the views in the Hierarchy).

Anyone have half an idea why resizeWithOldSuperviewSize is not being called? The frame of the parent rectangle is definitely being set…..

All the Best
Dave