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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:49:11+00:00 2026-06-09T04:49:11+00:00

It’s easy to enable the inspector bar for text views so that a bar

  • 0

It’s easy to enable the “inspector bar” for text views so that a bar appears at the top of the screen with various formatting buttons. (Although I had some confusion until I learned to make sure I was selecting the text view in a scroll view, and not the scroll view itself). I can either programmatically use [textView setUsesInspectorBar:YES] or go to the Attributes Inspector and check the “Inspector Bar” box in the “Uses” section.

My question is, how can I further control the inspector bar? I’m having trouble finding information on it in the XCode documentation or online. I’d like to be able to position it in a different place on the screen. Being able to pick and choose which specific controls are in the bar would be great too.

  • 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-09T04:49:12+00:00Added an answer on June 9, 2026 at 4:49 am

    The answer is, you aren’t meant to further control the inspector bar. There’s nothing in the documentation because, well, there’s nothing. Apple’s saying, use it or don’t use it.

    However, if you dig into it a bit, you will find that the inspector bar is a very interesting control. It’s not displayed as part of the text view, but rather (privately) embedded in the “window view” itself. When I say “window view,” I mean the superview of the content view.

    If you list the subviews of that “window view”:

    NSLog(@"%@", [self.testTextView.window.contentView superview].subviews);
    

    You end up with:

    2012-08-02 15:59:30.145 Example[16702:303] (
        "<_NSThemeCloseWidget: 0x100523dc0>", // the close button
        "<_NSThemeWidget: 0x100525ce0>", // the minimize button?
        "<_NSThemeWidget: 0x100524e90>", // the maximize button?
        "<NSView: 0x100512ad0>", // the content view
        "<__NSInspectorBarView: 0x100529d50>", // the inspector view
        "(<NSToolbarView: 0x10054e650>: FD2E0533-AB18-4E7E-905A-AC816CB80A26)" // the toolbar
    )
    

    As you can see, AppKit puts the inspector bar at the same level as other top level window controls. Now this is getting into the land of private APIs, but simply tinkering with the “window view” shouldn’t get any apps rejected.


    You can try to get a reference to the __NSInspectorBarView from here. It seems like it is always the subview right after the content view, so something like this may work:

    NSArray *topLevelViews = [self.testTextView.window.contentView superview].subviews;
    NSUInteger indexOfContentView = [topLevelViews indexOfObject:self.testTextView.window.contentView];
    if (indexOfContentView + 1 < topLevelViews.count) {
        NSView *inspectorBar = [topLevelViews objectAtIndex:indexOfContentView + 1];
        NSLog(@"%@", inspectorBar);
    }
    NSLog(@"%@", topLevelViews);
    

    Since this immediately breaks if Apple changes the ordering of the top level views, it may not be a good idea for an application for production. Another idea is:

    NSView *inspectorBarView = nil;
    for (NSView *topLevelView in topLevelViews) {
        if ([topLevelView isKindOfClass:NSClassFromString(@"__NSInspectorBarView")]) {
            inspectorBarView = topLevelView;
        }
    }
    NSLog(@"%@", inspectorBarView);
    

    I don’t know if the use of NSClassFromString() will pass App Store review guidelines, however, since once again, it’s dependent on private APIs.


    That being said, once you get a reference to the inspector bar view, things still don’t work too well. You can try repositioning it at the bottom:

    if (inspectorBarView) {
        NSRect newFrame = inspectorBarView.frame;
        newFrame.origin = NSZeroPoint;
        [inspectorBarView setAutoresizingMask:NSViewMaxYMargin | NSViewMaxXMargin];
        [inspectorBarView setFrame:newFrame];
    }
    

    But you end up with a misdrawn toolbar, so more work would be necessary there:

    enter image description here

    My ideas would be to try to shift the content view’s height up to cover up the gray left-over area (which would have to be done every time the window is resized, maybe tinkering with autoresizing masks may make it easier) and custom draw a background for the inspector bar at the bottom.

    EDIT

    Oh, and you should file a feature request for this too. bugreport.apple.com

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I need to clean up various Word 'smart' characters in user input, including but

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.