My NSButton with icon has no icon - macos

I have an NSButton in a nib that is set to an icon, and only an icon:
When I run the app, the icon, despite being one of the images provided by AppKit, is missing:
What's going on here? Why isn't my button's icon showing up?

Okay. In my little sample app I just created, I was able to get the icon to appear (took a bit of doing, though). Summed up, you need to change the button type to "Bevel" and increase the height if necessary.
Apparently "Push"-style NSButton types are too narrow to display the icon comfortably.

Related

Xcode: Image showing original size in simulator

I have created some images in UIViews and in scrollviews in a UIViewController. I go to run the app and the images are in scale but have blown up to there original size.
Interface Builder
Simulator
Any help appreciated!
If you click the image in IB, you see a dropdownlist in the left menu called mode in the Utillities pane. There I believe you should choose "Expect fit" or "Expect fill", unsure which you should use. When you choose that mode, the image should not rescale.
I think that is what you are looking for.

Xcode storyboard isn't visible; is it possible to zoom/pan the canvas?

I wouldn't ask if I couldn't find it anywhere else, but I've run into a problem. I have a complete storyboard built in Xcode, but I've lost it on the screen. Pressing the +/- buttons in the bottom right zoom in and out, but nothing shows up. I know the app is there because it runs fine, but all of my views are off the screen and I have no idea how to get them back. And since I'm on a desktop, there's no way to pan (maybe the same issue happens on a laptop?)
How do I get my storyboard back?
I searched for a "zoom all" in the menus but can't find one.
This is so frustrating. Grrr. I can't work on my storyboard until I can find it on the canvas. I can't find it on the canvas because I can't pan and have no idea where it is.
Right click on your storyboard file => Open As => iOS Storyboard

Nice new 10.7 Lion Toolbar Items

I wonder if anyone knows how to get this "Lion-style" toolbar items like we can see in Apple Mail application? Are they all custom or can be found anywhere? They are surely not present in IB.
Or are they just styled buttons and segmented controls?
The "Lion-Style" toolbar items would appear to be just Rounded Textured buttons with the image and alternate image set. You can drag these buttons directly from the IB library to your toolbar.

How to add other application's icon to Toolbar in Cocoa?

I have a window with some content that could be previewed, mailed,...
I decided that the best way to do this is to put appropriate application icons in toolbar, namely from Mail, Preview,...
Trick is, how to do that? Is thee any way too access other's application package and have access to its icon? Or is there any other elegant way?
Code:
// Get icon
NSImage *theIcon = [[NSWorkspace sharedWorkspace] iconForFile:#"/Applications/Mail.app"];
// Display icon (irrelevant in your case)
[theIcon setSize:NSMakeSize(128, 128)];
[theImageView setImage:theIcon];
There is also one other way of doing it, especially if you are building toolbar in IB:
right-click application icon
copy it
open Preview
select New from Clipboard
You will get complete set of application icons in any size. You can export them and put them in Image Well in IB

How to pass click on NSView through to app window beneath it?

My app has a NSView in a NSWindow which covers the screen and draws a semi-transparent shade on it, above that I've got another NSWindow which contains my app's UI, so the full screen view is designed to fade out background distraction of other windows.
How can I allow mouse clicks on the full screen view to go straight through to the underlying window, which will belong to another app, or even the desktop? Note that I don't want it to keep focus on my app.
Shady by Matt Gemmell does exactly the same, take a look at the source:
http://instinctivecode.com/shady/
It does this by sending the following message to the window:
[window setIgnoresMouseEvents:YES];

Resources