I have a different Selected Image for each Tab Bar Items. I gave the correct file name under Attributes Inspector -> Tab Bar Item -> Selected Image. But all I got is blue tint over my images. Selected Image does not displays.
Tried setting the image under User Defined Runtime Attributes. This doesn't work.
Select image in Assets.xcassets and set its 'Render as' property to Original image.
Related
On MAUI RC1 I'm seeing that when I type some characters in a SearchBar control and press Enter, the screen grays out, and then doesn't revert to it's normal color.
I've added a simple example above - you can see the background at the top of the screen is white, but the part of the screen that contains the search bar has the gray filter. I'm just wondering if it's supposed to add that light gray filter on top of the content, and if so, how do you make it clear back out?
I've created a new project with an empty NSWindow (zero code - simply configured it in .xib) and have set it to show the title bar but hide the title text, along with a transparent title bar & full size content view.
This works - I can drag the transparent title area at the top to drag the window around. However the standard double-click action no longer works.
I've set system preferences to minimize the window on a double click. It does nothing. I could potentially add a fake NSView where the transparent title bar is and handle a mouseUp, but there seems to be no way to determine if the user has selected "Zoom" or "Minimize".
How do I solve this? The solution presented in the question seems to work, however as I mentioned, I need it to minimize instead of zoom (rather - I want it to perform the default double-click action).
Seems like the only way is to read it off of an undocumented user default:
if UserDefaults.standard.string(forKey: "AppleActionOnDoubleClick") == "Minimize" {
window?.performMiniaturize(nil)
}
else {
window?.performZoom(nil)
}
I start learning Swift and try to fulfill using one image picker change button image when users trigger one of three buttons.
I watch online resource and understand how to use one image picker for changing one button image
But now I have three buttons, and each of them should have the ability to use image picker and change their own button image.
My solution for this is every time when the button is clicked and image picker is called, I set the UIImage outside the function equal to the info image
At meanwhile, knowing that image picker has triggered because the button was pushed down, I put a line for set-button-image with that UIImage in the button (IBAction function).
Below is my source code. Somehow the way I wrote will not update the button's image correctly.
Let me know if any information is missing or confused. Any advice or knowledge will be helpful, thanks.
sourceCode1
sourceCode2
main page
after clicking the add button the library shows
after select image, the button image shows all white
after clicking the white part, the image somehow shows
If I click another button, the button change like the first button???
So I basically dragged a button from interface builder's library, turned it into a Custom button. Then I added one png for the "default state configuration" and another png for the "highlighted state configuration". Let's just assume these png's are a red box and a blue box.
Now, I'd like the Title to display for the button i.e., "Press Me" or something. But the Title doesn't show. Am I missing something?? (I also tried to have that text in different colors but no dice...)
Thanks in advance.
Are you setting imageForState or backGroundImageForState? :)
When I set up a custom button in Interface Builder it hides the Title text.
Do you have to create the text for the button too or is it possible to change the Z order so that the Title appears on top?
You are probably setting the 'Image' property of your button instead of the 'Background' property.
'Image' appears over your text, so either programmatically or in NIB(way simpler), set the 'Background' image to your desired png, and set the text for the desired button 'State Config'(default, selected etc), Leaving the 'Image' property blank.
The title by default appears on the top and in no case the text goes behind the button...
Still follow the below steps
1. Drag uibutton to the view
2. Select UIButton
3. Click on the first tab of the Inspector
4. Then Enter the title over there.
The title entered will be on the button..
Hope this helps
For a custom button, I fixed the same problem by going in interface builder and in the tab where you can set up hte title, image, background, etc., if you look lower, there will be a section titled "Control". In that section you can change the alignment and there are also some checkboxes for "Content". Put a checkmark in "Enabled" and "Selected" and it should work. Ensure to have populated the title for the various states of the button.
It may be related to the State Config attribute. I had the same problem and solved it by doing this:
Select your button
In the utilities pane (right pane), select the Attribute inspector (4th tab).
Change the State Config (2nd attribute) to the value "Default".
Enter a Title and press Enter (I tried changing it directly on the button but it is resized automatically).
You may switch back to your previous State Config if it is what you need.