Je pense que vous ne pouvez utiliser setFrame de NSWindow: Affichage: Animer: Je ne pense pas que les fenêtres peuvent être dimensionnés automatiquement. Ainsi, lorsque vous modifiez le contenu que vous pouvez faire quelque chose comme ceci:
NSRect oldContentFrame = [oldContentView frame];
NSRect newContentFrame = [newContentView frame];
float widthDifference = oldContentFrame.size.width - newContentFrame.size.width;
float heightDifference = oldContentFrame.size.height - newContentFrame.size.height;
// Change the size of the window by the difference between the two views
// and move the frame up
NSRect windowFrame = [window frame];
windowFrame.size.width += widthDifference
windowFrame.size.height += heightDifference;
windowFrame.origin.y -= heightDifference;
// Remove the old content
[oldContentView removeFromSuperview];
// Change the size
[window setFrame:windowFrame display:YES animate:YES];
// Add the new view
[window setContentView:newContentView];
Je préfère tout d'abord essayer de créer moi-même: P – MatterGoal
juste pour la curiosité, la source de commande liée non plus accessible, savez-vous comment obtenir une copie? TIA! – Hofi