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 7952311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:49:24+00:00 2026-06-04T02:49:24+00:00

I have a Cocoa window, whose content view contains an NSScrollView that, in turns,

  • 0

I have a Cocoa window, whose content view contains an NSScrollView that, in turns, contains a fixed-size NSView.

Upon launching the program, the scroll bars displayed initially are too small, as if the content size was much larger than it actually is:

enter image description here

When I start playing with, e.g., the vertical scroll bar, and bring it back to the original position at the top, it gets resized to its expected size (which corresponds to the ratio of scroll view and content view sizes):

enter image description here

(Notice the horizontal bar, which still has incorrect size. If I then play with it, and bring it back to its leftmost position, it gets resized to the correct size.)

  • 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-04T02:49:26+00:00Added an answer on June 4, 2026 at 2:49 am

    I also encountered the same problem, I have searched everywhere but it seems no one else experiences this problem. Fortunately I found a hack which solves the problem.

    What I did notice was that when the window is resized or maximized the scrollbars resize to the expected size (autoresizing has to be enabled). This is because when the window resizes so does the scrollview and the length of the scroll bars gets recalculated and is calculated correctly. Possibly due to some bug the scroll bar lengths are not calculated correctly on initialization. Anyway to fix the problem, in your application delegate create an outlet to your window. Override the “applicationDidFinishLaunching” method and inside it call the method “frame” on the window outlet, which returns the current NSRect of the window. Using the returned value add one to the size.width and size.height. The call the method setFrame with display set to YES. This will resize the window and force the size of the scrollbars to be recalculated.

    Here is the code for applicationDidFinishLaunching Below

    (void)applicationDidFinishLaunching:(NSNotification *)aNotification
    {
    
         // Get the current rect
         NSRect windowRect = [_window frame];`
    
         // add one to the width and height to resize window
         windowRect.size.width += 1;
         windowRect.size.height += 1;
    
         // resize window with display:YES to redraw window subviews
         [_window setFrame:windowSize display:YES];
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very simple Mac Cocoa app that just has a Web View
I have an agent Cocoa app ( LSUIElement=1 ) that shows a normal window
I have a Cocoa App that depends on the main window being a certain
I have come across this Cocoa application (source code) that shows a main Window.
In one of my first Cocoa applications I have just a single window with
I have a Cocoa application that records datestamps on events. I need to know
I have a Cocoa application that, periodically, needs to install pkg X onto the
I have a Cocoa, Document-based Mac OS X application. One feature that I have
I have a graphics editing cocoa app on Mac OSX that produces 32 by
I have a cocoa application that has a finder like feel it and is

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.