Remove the baseline border of NSWindow title bar - cocoa

Is there a way to remove the baseline border of the NSWindow title bar without subclass
the window and implement a title bar view myself? (traffic lights button is real tricky)
I wanted to make view and put it just under the window's title bar without the baseline
border so that the my view below will appear to be "stick" or "continued" from the
title bar, that is, if I made my view the same color as the title bar.

You can achieve that by:
window?.toolbar?.showsBaselineSeparator = false

Related

Use combined titlebar + toolbar while preserving title visibility

The System Preferences app feature a combined title bar and toolbar with vertically centered buttons and the title. I am trying to mimic this exactly in my app. I have been able to combine the title bar and toolbar using Interface Builder (on the NSWindow check Title Bar and Unified Title and Toolbar), but this does not center the content vertically. I discovered via this question you can simply set the window's titleVisibility to NSWindowTitleHidden which will vertically center the stoplight buttons. Unfortunately this of course hides the title. How can one vertically center content in the unified titlebar/toolbar and also show the window's title just like System Preferences - either in IB or programmatically?
I ended up setting titleVisibility to NSWindowTitleHidden and manually created an NSView that contains an NSTextField that mimics the standard title appearance, providing that to the window's addTitlebarAccessoryViewController method. Still would like to find a better solution to use the default title appearance, if possible.
I used WAYAppStoreWindow on GitHub to do this. I created a fork of the WAYWindow subproject to vertically centre the document title since this wasn't supported. This means any applied themes/appearances are honoured.

Xcode Navigation controller bar color change

I am using SWRevealcontroller. I am trying to change the color of the navigation bar depending on the selection of the view.
It will only stay the same color of the initial bar color.
Any help guys? iOS7
You will have each view as a separate class, and then change the navigation bar color programmatically within the viewDidLoadmethod.

how to display the UISrcollView vertical Bar?

I define a UILabel inside a UIScrollView in my ipad.
But how to display the UISrcollView vertical Bar when the text is bigger than the scrollView ?
When I touch the scrollView the vertical bar appeared, but how to display it without touching ?
Regards
Fred
I think, its not possible. Setting showsVerticalScrollIndicator and showsHorizontalScrollIndicator properties you can display the scroll bar.
You can use flashScrollIndicators when the view becomes visible. It will guide user that scrollable content is available.

Title Bar Buttons and Custom Title Bars

I have created a custom title bar view for a blackened NSWindow (style 0), so that I can have it disappear in a similar manner to Quicktime X. The only problem is, the buttons don't respond to mouse over and mouse move actions on the title bar can get combined with pressing in the buttons.
The full source code is here: https://github.com/iaefai/OrganicUI under Classes/ORTitleBar.m and ORWindow.m.
The buttons are standard from this method:
self.closeButton = [NSWindow standardWindowButton: NSWindowCloseButton
forStyleMask:NSTexturedBackgroundWindowMask];
Then positioned:
[self.closeButton setFrame: __frame];
Then added to the titlebar:
[self addSubview: self.closeButton];
A small video of the disappearing title bar can be seen here:
http://web.me.com/iaefai/OrganicUI/ORWindow.html

Change color of title bar in cocoa

This must have been asked before, but after Googling I still can't find the answer.
How do you change the color of the title bar (The bar that you can click and drag around with the close, minimize and maximize buttons) to a different color than the default gray in Cocoa?
If you set the background color of a "textured" window (a distinction that isn't really all that visible in Snow Leopard) that color will be applied to the titlebar as well. This is what Firefox does.
I would recommend though not having a real titlebar (i.e. setting your window to have no titlebar) and using +[NSWindow standardWindowButton:forStyleMask:] and putting your own buttons in the "titlebar". This allows you more control and is way way less hacky.
If it's a panel, you can change it to black by instantiating it as a HUD window.
Otherwise, you can't. Ever notice how there aren't any Aqua windows with different-colored title bars roaming around in other apps? This is why.
The only other way to change the appearance of the title bar (without relying on private implementation details such as the existence of a frame view) is to make the window borderless and create its title bar and window buttons from the ground up.
If you go with Colin's approach of making the window textured in interface builder (check box in the attributes of the window), here's the line to change the background color of the window you'd put in this function of the appDelegate.m file
//In this function --->
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
//type this
[_window setBackgroundColor: NSColor.whiteColor];
If you don't mind private API, you could subclass NSThemeFrame.
Setting title bar appears as transparent
self.window.titlebarAppearsTransparent = YES;
And setting window background color as you wish

Resources