Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8507275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:49:26+00:00 2026-06-11T02:49:26+00:00

I have a window whose size I need to change when the user clicks

  • 0

I have a window whose size I need to change when the user clicks on it. I am using [self setFrame:windowFrame display:YES animate:YES] to accomplish this.

Even though the window successfully changes size (I increase its height), it moves the contents of the window up with it. How do I prevent this from happening? I want the contents to remain in place.

I am on OSX Mountain Lion developing an app for OSX using Objective-C and Cocoa.

EDIT: Constraints and/or Springs and Struts will not work as I need to move the contents around after the window is resized.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T02:49:28+00:00Added an answer on June 11, 2026 at 2:49 am

    Constraints and/or Springs and Struts will not work as I need to move the contents around after the window is resized.

    In that case, you should use NSViewAnimation.

    A single view animation can actually perform multiple animations to multiple views, and you can even do one to a window, despite the class’s name and the fact that windows aren’t views in Cocoa.

    You create a view animation with initWithViewAnimations:, which takes an array of dictionaries. Each dictionary identifies the target (NSViewAnimationTargetKey) and what to do to it: Either change the target’s frame (NSViewAnimationStartFrameKey and NSViewAnimationEndFrameKey) or fade the target in or out (NSViewAnimationEffectKey). For your case, you’ll be changing the targets’ frames.

    When the user does the thing that causes the resize of the window, you’ll need to compute the desired overall size of the window (taking care to adjust its frame’s position so it doesn’t grow off the screen), as well as the new frames—both positions and sizes—of your views. Everything that will move and/or change size, create a dictionary for it and throw it into the array. Then create the view animation.

    An NSViewAnimation is a kind of NSAnimation, which provides all the methods for starting and stopping the animation, monitoring its progress, hooking into it, and chaining multiple NSAnimations together. If nothing else, you’ll need to start the animation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a window whose handle is handle_parent. Then I created a child
I have a window I've created using UiBinder. I'm followings Sencha's HelloWorldUiBinder example and
I have a RelativeLayout whose size takes up all screen area that is available
I have an iPhone application that's using Navigation Controller to display the top bar
I have an array of RGB values, whose size I can guarantee to match
I have a window contains different kinds of controls. class FindReplaceWindow(wx.MiniFrame): def __init__(self, parent):
I have a C# Windows Forms application, whose prototype was created on SQL Server
I have window form in my WPF Application when I open new window from
I have a window with a MenuItem maddbound3 with the following ActionListener: maddbound3.addActionListener (
I have a window containing three NSTextField s, like this: +------------------------+ | +--------------------+ |

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.