Can Xcode infer an UIImageView's size from an image in a storyboard? - xcode

(I'm aware of how this is done in code)
When you plop an Image View into a storyboard, and then assign an image to it, is there some convenient way to resize that Image View to the size of the image? So far I've just been keying in dimensions manually, and it feels like I'm missing something.

Yes you can. Just press command and = buttons.

Related

Resizing image in QT 5.15

Toolbar view in application currently
I need to make the image in the toolbar bigger so that one can see the text.
Code so far:
[Code](https://i.stack.imgur.com/tZASn.png)
So, how would I go about resizing the image so that the text in it is clearly visible. Right now the image is too small in the toolbar. Thank you
fillMode is your issue here, if you comment that out it will not resize to fit in the (small) height of the toolbar

In XCode 8, how can I make an image button with padding?

I have an button, and I told it which 'image' to use (setting the image in 'background' works too). I would like to make the image inside the button to be smaller than the button. I tried changing the content insets, the title insets, and the image insets, but none of them seem to be working. The content and image insets scoot the image around, but do not make it smaller.
I would like to accomplish this in the main.storyboard, and not do it programmatically, if possible.
Not the best solution but if you need any easy work around you can add the image as an UIImageView and then add a clear button over it with the padding u need

Xcode 6.0/6.1 Interface Builder resizes views to fit whole content when clicked on the corner grip to resize

I think this is an obvious bug on Xcode 6.0.1 but I'm searching for at least a workaround. In interface builder, I have an image view that is smaller in dimensions than the image that it contains. Here is my newly created, fresh nib with just an image view, the heart image is a larger PNG file than the containing image view:
So far so good. However, when I click on the any of the grips at the corners/edges of the view to resize the image view, it immediately changes to this the very moment I click on the grip:
This happens whenever I try to resize by hand (I can resize using width/height values at inspector though) and I have hard time trying to fit my design into the nib. The problem happens both on nibs and the storyboards. Does anyone know a workaround?
UPDATE: I've updated to Xcode 6.1 but I'm still having the same problem.
The same result I've noticed when close and reopen the project. The view continues to grow up every time. I have created a simple project to search the cause of the wrong behavior of the autoresizing mask (flexible width AND align to right).
So, try to disable "flexible width/height" and "align to right". Keep the "align to left" only.
This answer is for autolayout-enabled views/nibs. For autoresizing mask solution, see Nicolai Nita's answer: Xcode 6.0/6.1 Interface Builder resizes views to fit whole content when clicked on the corner grip to resize
I've solved the problem by setting the content compression resistance priority (both vertical and horizontal) to 250 from 750. I don't know why it wasn't the case before Xcode 5 though.

Cocoa Scrolling Image Menu

I want to make a menu with a wide image that scrolls horizontally (it's a continuous image). What technique could I use for this?
Thanks!
The standard way to do this is to create a NSScrollView and nest a NSImage in it. You could run into problems if your continuous image is too large, however. In that case you'd want to split it into multiple NSImages and arrange them next to each other in the NSScrollView.

Proper way to use images in NSMenuItem?

I've put some images next to NSMenuItems using the image option in Interface Builder. The custom image is a simple PNG. I was hoping the system would automatically alter the color of the image during mouse over like it does with stock images. It does not. What am i doing wrong?
Here's a pic of a stock image vs my custom one:
In code, call [menuItem.offStateImage setTemplate:YES]

Resources