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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:51:42+00:00 2026-05-27T00:51:42+00:00

I have a view-based NSTableView that usually has one column in it. However, at

  • 0

I have a view-based NSTableView that usually has one column in it. However, at a button press, I want a new column to slide in from the left (very similar to what happens on an iPhone when you click the Edit button in Mail). For now, the view that I want to slide is in a very simple view that draws a solid background: its drawRect: just does

[[NSColor blueColor] set];    
[[NSBezierPath bezierPathWithRect:[self bounds]] fill];

In the delegate for my NSTableView, I have the following:

- (IBAction)buttonPressed:(id)sender
{
        NSTableColumn *newColumn = [[NSTableColumn alloc] initWithIdentifier:@"InPreviewColumn"];
        [newColumn setWidth:40];
        [newColumn setMinWidth:[newColumn width]];
        /* To make up for there not being an insertColumnAt: method, 
           hide the column, add it, and move it to the front before showing it. */
        [newColumn setHidden:YES];

        [availableFontsView beginUpdates];
        [availableFontsView addTableColumn:newColumn];
        [availableFontsView moveColumn:1 toColumn:0];
        [availableFontsView endUpdates];
        [newColumn setHidden:NO];
}

- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
{
   /* ... code for main column ... */
   else if([[tableColumn identifier] isEqualToString:@"InPreviewColumn"])
   {
     USSolidBackgroundView *v = [tableView makeViewWithIdentifier:[tableColumn identifier] owner:self];
     if(!v)
     {
        v = [[[USSolidBackgroundView alloc] initWithFrame:NSMakeRect(0, 0, [tableColumn width], 0)] autorelease];
        [v setIdentifier:[tableColumn identifier]];
        [v setAutoresizingMask:NSViewMinXMargin | NSViewWidthSizable | NSViewMaxXMargin];
     }

     return v;
     }
}

Yet, when I do this, I end up with this result (there’s a big non-blue margin between the blue part of the new column and the start of the main column):

enter image description here

When the additional column isn’t present, there’s no margin so I’m pretty sure that the problem isn’t with the other view (since there’s no margin when it’s the only view displayed).

I’ve used logging statements to verify that solid color view’s bounds always has a width of 40 (in its drawRect:) and, at least when the view is created, the table column has a width of 40 as well.

So where does this margin come from? No matter how I size the column, it seem that only roughly half of it is blue. So, the bigger the column, the bigger the margin.

How do I make the entire extra column blue?

  • 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-05-27T00:51:43+00:00Added an answer on May 27, 2026 at 12:51 am

    The issue was my being stupid: In the view that draws the font names, I was basing the position on [self frame]. Which is wrong.

    [self bounds] is the way to go. Which I knew. Can’t believe I made this mistake. Amateur hour.

    If you wander by this question, feel free to vote to close it or flag it or whatever it is that’s supposed to work on Stackoverflow.

    My apologies.

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

Sidebar

Related Questions

I have a View-based app. The first view that is loaded has a button
I have a view-based app that just does one thing : show a array
I have a view based application which has some textboxes that I'm trying to
I have a view-based tableview that needs to have the following functionality: Has some
I have a view-based NSTableView that is populated through bindings. My textFields & imageViews
I have a view based NSTableView with a custom NSTableCellView. This custom NSTableCellView has
I have a simple view-based app from that template. It has nothing else in
I have an view in my App which has a number of buttons based
I have a view based app. Its self.view has several subviews and shouldAutorotateToInterfaceOrientation is
I have a view based app that works well. (In other words, I'm not

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.