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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:49:32+00:00 2026-06-15T19:49:32+00:00

I have an issue with tableview scrolling. I have dragged a scrollview in to

  • 0

I have an issue with tableview scrolling.

I have dragged a scrollview in to the xib with the frame.

And I am creating a tableview programmatically and adding this to the scrollview as follows:

NSRect frame = [[ScrollView contentView] bounds];
rTableView = [[MTableView alloc] initWithFrame:frame];

MTableView is my custom class inheriting NSTableView and in the constructor, I am adding columns to the table view.

[ScrollView setDocumentView: resultsTableView];
[ScrollView setHasVerticalScroller:YES];
[ScrollView setHasHorizontalRuler:YES];

[rTableView setDelegate:self];
[rTableView setDataSource:self];
[ScrollView addSubview: rTableView];

[rTableView reloadData];

I have written the delegate functions to load the data and Table is being filled with the data. But the scroll does not work. I have 100 rows in the table and I am able to see the first 21 rows at the initial load of table view. And with the scroll nothing happens and the row index (that’s in the data delegate) is always either 19 or 20. I am not sure what’s going wrong here. I have seen some old posts in stackoverflow, followed the documentation of NSTableView but not of much help.

Any help is much appreciated.

  • 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-15T19:49:33+00:00Added an answer on June 15, 2026 at 7:49 pm

    You’re doing everything right except for this line:

    [ScrollView addSubview: rTableView];
    

    A standard NSScrollView + NSTableView arrangement has the NSTableView set as the documentView of the NSScrollView. You’ve properly set up this relationship programmatically in your code:

    [ScrollView setDocumentView: resultsTableView];
    

    When you added the [ScrollView addSubview: rTableView] line, that added the table view in a way that wasn’t intended. Basically, this addition only serves to prevent you from seeing the properly-scrolling table view that is beneath it.

    Removing that [ScrollView addSubview: rTableView] line should allow you to see the table view properly, and allow the scrolling mechanisms to work properly.

    An NSScrollView has numerous subviews that make up the scrolling architecture (see Scroll View Programming Guide for Mac). Examining the standard “NSTableView inside an NSScrollView” that’s available in the Interface Builder palette shows that the scroll view has 4 immediate subviews:

    "<NSClipView: 0x103507200>",
    "<NSScroller: 0x101b14f80>",
    "<NSScroller: 0x101b15210>",
    "<NSClipView: 0x103507be0>"
    

    One of the clipviews holds the NSTableView and the other holds the NSTableHeaderView. Using NSScrollView‘s setDocumentView: in the line [ScrollView setDocumentView: resultsTableView] properly sets the table view to be the respective NSClipView‘s document view. On the other hand, adding the table view as a direct subview of the NSScrollView will cause the unexpected results you’re seeing.

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

Sidebar

Related Questions

i have a performance issue in my tableview my cellForRow looks like that: if
I have a very strange issue with the tableview: I have a table cell
We are new to ROR, We have issue in creating Login/Logout process in ROR
I am adding a dynamically scrolling UISearchBar to the top of a tableview. To
Have been stuck on this (beginner) issue for a while so am now asking
I have an issue in creating a CheckMarkAccessoryView in the UITableView .When i select
I have been looking for a solution to this issue for a few days
I have a tableview with my custom tableViewCell. The issue that I want to
I am having an issue: I have a tab-bar based app. In MainWindow.xib for
I have performance issue in UITableView scrolling when I use imageWithContentsOfFile instead of imageNamed.

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.