Replace IKImageBrowserView's Superclass with NSVisualEffectView - macos

I looking to make my IKImageBrowserView's background have a blurred background. According to the Apple Documentation, the IKImageBrowserView is based upon NSView. Is it possible to make an IKImageBrowserView inherit from an NSVisualEffectView instead so that I can give the background a blurred look. I assume that to start I must subclass the IKImageView, but I am unsure of where to go next. Could someone please point me in the right direction?
Thanks

Add the IKImageBrowserView as a subview for an NSVisualEffectsView and make sure the browser view doesn't draw it's background.
The visual effects views are intended to be used in this way, not through class inheritance.

Related

NSSlider without background

When ever my NSSlider is displayed, it has a rounded rectangle background (see the linked image). I would like it to only have the bar and the knob drawn, not this background.
I have looked into subclassing NSSliderCell or NSSlider, but it seem that no matter what draw method I override this background will not go away. Is there anything I can do to get rid of this background, or are my only option to make my own control?
Thank you
Søren
Uncheck the Bordered option in Xcode or you can set it to NO in code.
If that doesn't work you've got it inside an NSBox or something

Why does this textured NSWindow suddenly change its background gradient when resizing?

Can someone please tell me, why the background gradient of the textured NSWindow in this app suddenly changes, when you make the window a little bit smaller?
This is the minimal example I could find, that exhibits this behaviour. App & Source are available via Dropbox.
-- Updates:
If you put the slider lower,the gradient does not change when resizing the window:
Also, the change seems to happen when the distance between the slider and the window's right border gets smaller than the HIG says it should be.
It is really interesting question =)
I don't shure, but guess, this problem is connected to layers displaying.
If you still want to use textured window, you can put additional NSView object in the interface builder between NSView and NSSlider (NSWindow -> NSView -> NSView -> NSSlider). It fixes the bug.

Is it posible to use free form shapes as windows in OSX?

I want to use a free form shape (e.g. A partially transparent image) as a window backgound without the standard close and maximise buttons. Like the widgets do. Is that possible in OSX? I could not find any info on that or an app that uses this.
Thanks
Yes. You can do this by subclassing NSWindow to make it borderless and transparent. You'll also subclass NSView to draw the visible custom shape, then use an instance of this view as the window's content view. The result will be a window whose only visible parts will be the shape your content view draws.
Here's a good article with an example.

Autosizing boxes and positioning in Cocoa

I'm creating an application, from which a part looks like this:
boo http://img188.imageshack.us/img188/7808/schermafbeelding2010021y.png
I all dragged them to a window in IB, but the problem is that the NSImageView, Action Buttons (Suggest, Send, Poke etc...), Information NSBox, and Friends NSTabView can all vary in height. They should always be placed below each other, with a margin of 8px. Just like on Facebook. I thought of a very modified NSSplitView, but maybe there are easier ways. Can anyone help me out?
Edit: I have placed the action buttons in a Custom View with class NSView.
Thanks
You'll have to manually resize the views yourself. Cocoa does not provide Java-style LayoutManagers. However, I don't think it would be too hard to recreate one...

How do you create a custom themed NSButton?

How do you create a custom themed NSButton? I don't mean in a small way like changing the background color or changing from rounded edges to square edges. I want to replace the entire look and feel of the button. Is that even possible to do in Cocoa? Obviously I would have to subclass the NSButton class and go from there. Any help would be much appreciated.
Actually, you need to subclass NSButtonCell. You should read Apple's documentation on this to gain a better understanding of how they interact. You probably will still want to subclass NSButton so that it will use your NSButtonCell subclass, too.
For a button, most of the work is done in drawBezelWithFrame:inView:. If you want to alter the way the text or image is drawn, you would override drawTitle:withFrame:inView: and drawImage:withFrame:inView:.

Resources