How to apply the window-frame roundTextured bezel style to an NSButton that's not in the window frame? - objective-c

If you can edit the title and make it shorter, good on ya. Which is to say, sorry for the title length :P
In the HIG:
http://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/AppleHIGuidelines/Controls/Controls.html
Scroll down to the section "Window Frame Controls". Buttons with NSTexturedRoundedBezelStyle draw differently when placed in an NSToolBar (darker gradient).
Putting HIG questions aside, I need the darker bezel for a button that is not in the window frame. It seems there is some flag which I am missing.
I can obviously just draw it myself, but wanted to check if there's just something totally obvious I am missing here?
Kind regards,
Alec

As of Lion, the Round Textured button is translucent, which means that some of the background shows through it. That's why it looks different in the toolbar, because there's a darker background behind it.
There is no magic flag to change this behaviour, the only way to give it a darker appearance would be to place it on a darker background.

Related

Custom Titlebar in a Cocoa Application

I need to create a (very) custom titlebar in a cocoa app. I read about the INAppStoreWindow library, but it seems it doesn't have the feature that I need. So here's what I have need to do (see image for clarification):
My titlebar is the thing between the green and red circle
The text (Text1 - Text3) are all images
The black circle with the exclamation mark is also an image
The grey area below the title bar is a webview. It expands from the left border all the way to the right edge of the reddish sidebar. (This is actually where why I think that the INAppStoreWindow won't work, as I cannot specify a width for the title bar)
The images should have an Action
Text1 through Text3 as well as the black circle load some URL into the webview
Red circle closes the app
My app has no borders and no shadows. Right know in order to be able to move the app I drew a Box element at the top where the title bar should be. I think I can draw something in it as well, but as I'm very knew to cocoa development here are my questions:
How can I draw some images in the Box element?
Is there a better element to draw the titlebar in?
I know that are two questions, but they are closely relatated. It's generally: How to draw a simple titlebar like this?
As the problem inside the titlebar is the same for every item I need to draw (they are all images) I belive there is a quite simple solution for that, but because I lack the experience of how to solve this I'd need your help. You can also point me the the right direction in the comments and I'll answer this question myself after I've got it right.

NSButton rendering issues when displayed over NSImageView

I have a NSButton sibling on top of a NSImageView.
Whenever I click the window, there are some rendering issues. It looks like this:
As you can see, the white edges are the problem.
Strangely, this problem even persists if I override drawRect:.
Nothing gets rendered at all, but whenever I click it, those white edges appear.
Also, when the background-image changes, the button gets redrawn and the edges disappear.
Any idea what might cause this?
EDIT
I found out that this actually happens with every single instance of NSView
and it actually clears part of the buffer (you can see the desktop wallpaper):
EDIT 2
I also just found out that this does not happen if I layer-back the windows content-view.
Well, this question was impossible for anyone to answer.
My window had a custom contentView, which was just drawing a view with rounded corners.
Instead of using self.bounds, I used dirtyRect to draw the background.
So when the contentView wanted to redraw the background of the controls that were updated, those rounded corners were cut out.

How to customize UISegmentedControl font color and UIToolbar gradient?

It seems Apple's UIToolbar and some of the controls you can place on it, such as UISegmentedControl, allow very limited customization. For example, we want our toolbar to looks something like this mock:
However, UIToolbar only has a single tintColor and 3 built-in barStyle values that you can apply to it, so we can't get the gradient we're after. Is there some way to set the background image like many of the other controls?
Even worse, the UISegmentedControl doesn't let you specify font or font color. It seems to enforce white 11pt Helvetica with a drop shadow, and the white is almost unreadable with the light tintColor we're using.
I'd hate to rewrite UISegmentedControl just to change the text color. But the only solution I've seen is very hacky -- it digs into the subviews of the subviews and changes properties on those -- seems likely to stop working whenever Apple feels like changing or disallowing it.
Is Apple really against us changing the text color on our segmented controls, or is there something I'm missing here?
Update: Apple finally added functions for customizing appearance in iOS 5. See jfortmann's answer.
You want to use the setBackgroundImage:forState:barMetrics: methods (probably on your appearance proxy) to set the background image. The text can be modified with setTitleTextAttributes:forState:. And finally, you'll need to change the divider for the possible states with setDividerImage:...
The docs are very informative as to how the images have to look.

Weird black corners at edge of Grouped UITableView

I have an UITableView in my application, which is in an UIView that has it's background colour to the Scroll View Texture thing. This is all in an UIViewController. It works all nicely and stuff, but I get these fugly black corners around my table view edges:
The Background colour of the table view is set to the clear colour, and those squares even appear in Interface Builder. Any ideas on how to eradicate these evil UI blemishes? They make my UI look like something that was thrown together in 3 minutes, even when I spent more than a week designing my entire UI. It makes me want to punch UITableView in the face, too.
Quite strangely, setting the background to clear in code seemed to solve it for me. It is a really weird issue, and I submitteda bug report to Apple about this, although their bug reporter needs it's own bug reporter.
Also make sure the background color is not just clear color, but that opaque is NO.

Blue border appearing around NSScrollView

I'm sure this is normal and I'm just misunderstanding something, but since making one of my NSScrollViews slightly inset from the bottom of the window (as opposed to taking the full height), a blue border has appeared around it.
I've set NSNoBorder on the scroll view, so this must be something else.
[scrollView setBorderType:NSNoBorder];
Any pointers would be greatly appreciated. I'd like the border to go away as it spoils the look of the app and just looks broken.
I assume it's the scroll view. The view inside it as an NSOutlineView, so maybe it's something on that?
That's the focus ring. It shows which view is going to get the keystrokes if the user types anything. If you suppress it, then your app will not be in compliance with the UI guidelines.