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

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

Related

React Native bunch of buttons on top of background image

I have a background image and I need to add bunch of oval buttons or images on in my case the "greenish" buttons on top of the background image, that I can click in each one of them and call a function passing a parameter. Please look on the screen shot and let me know how I can position every one of the buttons on top of the image and access them with a click (onPress). I guess the only way is using flex box but I couldn't figure out the style for it.
Thanks
Just style all the green buttons on relatively to the image's boundaries with position: absolute. Percentage values for positioning should work, if your image scales properly on screen size change.

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

(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.

Highlight selected image in Windows Phone XAML?

I am currently using the Image control in XAML, when the user taps on the image I want to display another image like a tap effect*, so for example I want to make the image a bit darker or lighter once the user taps on it, how can I do this using the image control?
I've managed to fix this with adding a new image to the mousebuttonup, mousebuttondown and mouseleave event of the image control
You could place a collapsed image with the same size at the same position as the first one. If the user taps the image, you show the previously collapsed image.
If you want to make your first image darker, set the background of your hidden image to black and opacity to 0.25 or something like this. When it gets visible your first image will be slightly darker.
Instead that you can try to customize the style of your button. In Visual State>>Pressed>>You can change the Color or you can give some animation as well.
tHANKS,

Set background to an listview

I want to set an background to my listview that have different size (depending the appearance of softkeyboard). My list view is in between the editboxes and I want my editboxes always to be visible (means I do not want to use adjustPan).
My problem comes in the moment when the android adjust the size of my listview and the background get tweaked. I want my background to remain the same, just to be cropped.
and I want to look something like this
Is there any style that I can add that will make the image act like this, the point is to do NOT do an resize and to fill the whole available area. And to DO something like a CROP , means to show as much as there is an space and then the rest just to be cropped.
I found some workaround for the problem I want to solve. I set the scaleType with "centerCrop" value and it seems to work fine.
I hope this will save time to someone else having this problem...
Try in your Manifest to add
android:windowSoftInputMode="adjustPan" or "adjustUnspecified"
for your <activity
Read more about values here:
http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft
I would put the listview in a linearlayout and put the background on the linearlayout.
As for the textbox at the top, if you have not figured that out, use relativelayout.
Here is a good link about the view being re-sized by the keyboard:
http://groups.google.com/group/android-developers/browse_thread/thread/be5ffe40c2bc29f0?pli=1
Here is a good link for the button staying on top:
Add Image at above of listview

QT QPushButton with an icon and overlaid centered text

I recently took to Qt Programming and want to port my app to Qt.
I'm fiddling with QPushButtons and I've managed to display an image into the button and to set some text to the button but, whatever I do, with or without the designer,
I have the same problem, the text is aligned right to the icon instead of being overlaid over the icon.
addButton = new QPushButton();
addButton->setIcon(QIcon(":/AddButton.png"));
addButton->setText(tr("+"));
addButton->setFlat(true);
addButton->setIconSize(QSize(100,90));
What am I missing ?
I know there is the toolButton but it doesn't seem to have the "flat" property.
Any idea please ?
Thanks a lot,
Mike
If you are trying to use your image as a background image, you can use a style sheet:
addButton->setStyleSheet("background-image: url(:/AddButton.png);"
"background-repeat: no-repeat;"
"background-position: center center");
You'll just have to make sure the size of your button is at least as big as the image.

Resources