I need to change the image of the tab bar item based on one of the option selected in my first tab at runtime. Whenever user changes the option the tab bar item image should change.
For example: I have 3 tabs. In first tab I have following options:
"Red"
"Green"
"Blue"
According to the option which user selects, the tab bar item image should change. (ie. for red, all 3 tabs should have red icons and so on)
How can I achieve this?
Thanks for helping :)
Related
I have a tab group with two tabs. The tab name is being displayed two times, one under the tab icon on the bottom and one on the top of the app just under the status bar.
I want to remove the top tab title on iOS.
Thanks.
Regards
You can set navBarHidden:true to your Window inside the tab to remove the navigation bar.
Because you want the navbar to remain, and don't want a title. Don't set one! By default there is no title on the window, and window title and tabbar title are separate! This is how it should look after:
<TabGroup>
<Tab title="required">
<Window></Window>
</Tab>
</TabGroup>
Same structure can be applied when you use classic.
If you want to remove the title at some point instead of always, you can just call window.title = ""; and it will be removed. Of course replace "window" with the variable or alloy id (in which case it is $.id)
Is there a way to make chosen Tab Bar Item look disabled programmatically?
I have Tab Bar, almost everywhere its Items look active (it is delete, edit, search buttons). But on some pages some of its Items has to be inactive, showing user that he can't edit/delete anything here. I'm thinking, is there a way to change the visual appearance of chosen Tab Bar Item? Or better to use just set of the Buttons?
all active items/buttons in a bar, screenshot
all active items/buttons in the bar, screenshot
UPD: Desigion for disabling Item found, but when I make the Item disabled, I need to change its colour. Now it has the same color as UITabBar.appearance().unselectedItemTintColor but with transparency. Is there a way to change color and transparency for disabled Item (make it coloured differently and not transparent), keeping the colour for unselected Items?
For required tabbar item try to set false for .enabled property.
Obj-C
.enabled = NO;
Swift
.isEnabled = false
Alternatively, you could make your tabBar dynamic and instead of disabling/enabling, only show the relevant items. This way, the items are always nicely displayed and you don't have any gaps as you have in your screenshot.
I've created a custom tab bar icon and made sure to set the background to transparent. The outline of the icon highlights when selected, but doesn't fill as system icons do.
From the Human Interface Guidelines manual:
Provide two versions of custom tab bar icons. Provide icons for both
the selected and unselected states. The selected icon is often a
filled-in version of the unselected icon, but some designs call for
variations to this approach.
My question is after I created the two versions of the icon as directed, how do you set it?
Using storyboard you need to select your tabViewController and define the tab item properties according your needs
Hope this helps you
I would like to have my tab bar similar to the App Store app (picture below). The active section has a coloured solid icon, and the other non-active sections will have the uncoloured outline icons. How can I switch from outline icon to solid icon depending on if it is selected or not? I would preferably want to accomplish this in interface builder but if thats not possible please explain how to do it in code. I have also provided a picture of my current tab bar. Notice how all of the icons are "outline" icons including the active section icon (I want the active section icon to be "solid"). I do have both the outline and solid icon sets, i'm just not sure how to use them both.
My current tab bar:
App Store tab bar (what I want but with my color not blue):
"You can use storyboard to set selected image of tabbar. I tried and it worked for me. Select the UITabbarItem and add a run-time attribute 'selectedImage', select Type as 'Image' and give the name of your image as its value."
iamge that shows how it's done
Had the same problem, answer from here: Setting Selected Image in Tab Bar Controller with Storyboard
In Xcode 6, you now have the ability to set the icon for a tab item for its selected and unselected states. Please see the descriptions in the images below:
and
The only problem is that the image for the SELECTED states does not show. It just shows blank. Anyone else have this issue? Please see the screenshots below of the results:
and
Thanks!!!
So the way to go around this:
Set the tab with the default, unselected icon image you want to use in the "BAR ITEM" section in the Attributes Inspector:
Click on the Identity Inspector, and under "USER DEFINED RUNTIME ATTRIBUTES," click the + to add a new value.
KEYPATH: selectedImage (IT HAS TO BE THIS!!!)
TYPE: Image
VALUE: The name of your selected/highlighted icon image. I use Images.xcassets for my image assets.
Run your app. You'll notice that the image changes to the selected (not just highlighted version of it.
Works like a charm.
I want to add some info about the colored tab icon.
To change tab selection color:
Select the tabItem.
Set "tintColor" attribute with your prefer color.