I found that when I reassign a NSView(viewA aleardy added into superView) to another view(new viewB) , as below:
viewA = [[NSView alloc] init]; viewB = [[NSView alloc] init]; [self.view addSubview ViewA]; veiwA = viewB;
viewB will not be updated into superView, event I try the following methods:
[viewA setHidden: YES]; [viewA setHidded: NO];
[viewA setNeedLayout: YES];
Only to removew viewA and re-add it back to it's superview will work:
[viewA removeFromSuperView]; [self.view addSubview:viewA];
Could anybody help to explain why method 1) and 2) cannot update the rect of viewA ?