Customize UITabBarItem in iOS - ios

I'm trying to solve a frontend problem. I need to customize a UITabBarItem with this stackView
-Image
-Text
-Image
I know that the Standard UITabBarItem has only the properties of an image, a selected image and a text label.
I can't put the text inside the image because the app has more languages so I can't have an image per language.
What should I do?

You can indeed have localised images documentation link.
Apart from this, there's not much you can do with UITabBarItem.

Related

UIButton is out of navigation bar

I have a custom UI Button (just regular button but with image), within the navigation bar, but when I choose my image it looks like this in designer:
As you can see here, it's over my provider and status labels, and also when I run application it's over the WebView (which is bellow), so definitely out of navigation bar. I tried to find in storyboard some property where I can adjust this but I couldn't find any. I'm using swift and storyboards.
Appreciate any help, iOS newbie :)
Based on your description I think your issue is that you are trying to add a button for navigation. What you need is a NavigationBar with a NavigationItem/BarButtonItem in it. If you look in the object library you will be able to find these.
Just drag them onto your story board. Once there select the button and in the side menu you will be able to select the Image for that Item. Now it is in the navigation bar up top. Let me know if there are still issues. 👱🏼
You have to make sure your 1x image is to the specified size (and then your 2x etc, or just use a PDF at the 1x size.
Icon sizes are here: iOS Human Interface Guidelines: Icon and Image Sizes
I made my pdf 22x22 and added it to .xcassets with scale factor "single vector"

iOS button backgroundImage vs image

for a button I see 2 fields: background image and image. Is the only difference that a background image allows for text on top of it?
These images serve different purposes.
The backgroundImage is the graphical representation of the button. This image typically represents the different possible states of the button (normal, selected, highlighted) and is usually stretchable (horizontally and/or vertically) to be usable with varied button sizes.
The image is content that sits within the button and is the graphical analogy to the text property.
A common usage pattern would be to use the same backgroundImage for multiple buttons in your app for a consistent theme but to use different images depending on the contextual meaning of each button.
Also, backgroundImage is not used for layout calculations. For example, [myButton sizeToFit] will take into account the image but not the backgroundImage.
Yes, it's the only difference I know

IOS UITabBarButtons Without image

How can i make a UITabBar without Images? I just want text, centered in the buttons.
If by "centered", you mean "horizontally-centered", I would just use fully transparent PNG images for your design.
I you also mean "vertically-centered", there's no way to achieve this with UITabBar and text.
Maybe you can trick it by using an empty text for your tab but creating images for the text you want but the text will be rendered blue and it might be ugly/not meet Apple's standards so I would strongly advise you against it.

Custom the backgroud of a UIButton or UIBarButtonItem on segControl & bars

I'm trying to change the appearance of my UIButtons int the view as well as UIBarButtonItems in the NaviBar or toolBar or SegControl.
And here are 2 questions.
NO.1. How can I set customed background pictures to the buttons I mentioned while I can change their titles programmaticly? I mean I found that if I set the background of a button, the title seems to be concealed by the background image?
NO.2. I tried to add the text of the title directly on the png, ( which is actually a imperfect way since I need to change the title during the runtime). Anyway it works out both the image and the text, but the resolution seems to be reduced because the text became sort of blurred.
Can anyone give me some advices how to achieve it? Thanks a lot!
NO.1 The button title should not be obscured by the background image. Are you setting the button's image in code like this:
[btn setBackgroundImage:image forState:UIControlStateNormal];
? You may be instead setting the button's image property (which is different from its background image).
NO.2 You really don't want to be adding text to the button PNG, for the exact reason you mention. Buttons in iOS are designed to display images and text the way you want - put your energy into getting the built-in buttons working the way they should. There are umpteen billion tutorials out there about how to do this.

Increase width of tab bar item to fit image

I am doing a simple tab based app, with one 2 tab items and I would like to have an image in
each tab.
The problem is, tabbarcontroller is cropping the images rather than fitting them in. I just have two images, basically text, saying "ABOUT","SETTINGS" and i would like them to take the full width of the tab bar. Something like the attached image. How can i achieve this without the images getting cropped.
Referring to the image "ABOUT" & "SCAN QR" are images.
Thanks
I don't think what you wish to accomplish is achievable by using the standard controls.
I'd recommend using a custom toolbar instead of the tab bar controller.

Resources