uitabbaritem

UITabBar change background color of one UITabBarItem on iOS7

╄→гoц情女王★ 提交于 2019-11-27 06:52:52
问题 Can I change the background color of a specific UITabBarItem in a UITabBar ? I know how to change all the background of the selected background, using: [[UITabBar appearance] setBarTintColor:[UIColor redColor]]; [[UITabBar appearance] setTintColor:[UIColor blueColor]]; [[UITabBar appearance] setSelectedImageTintColor:[UIColor yellowColor]]; But can it be done for only one item without subclassing? Thanks 回答1: You can add a subview to the parent tabBar, and set a background color on the

What size should TabBar images be?

六月ゝ 毕业季﹏ 提交于 2019-11-27 06:15:23
I have icons for a tabBar of size 100. I checked at Apple's Human Interface Guidelines and it says the image size should be 30x30 / 60x60 . But as the height of tab bar controller is 50, I kept the size of the image at 50x50 . Now, when I run the project, I see the ugly design below: Any idea what size images I should use so that the design will be perfect? Note: I am not writing text also (e.g. Home, Search, etc). The text of the tab button is there in the image itself. 30x30 is points, which means 30px @1x, 60px @2x, not somewhere in-between. Also, it's not a great idea to embed the title of

Moving UITabBarItem Image down?

♀尐吖头ヾ 提交于 2019-11-27 06:09:35
Normally on each tab of a UITabBar you have a small image and a title naming the tab. The image is positioned/centred towards the top of the tab to accommodate the title underneath. My question is: if you want to have a tabBar with just an image and no title is there a way to move the image down so it centers better within the tab? I am using (see below) currently: [tabBarItem setFinishedSelectedImage:tabSelected withFinishedUnselectedImage:tabUnselected]; but would prefer to use to larger image with no title, at the moment if I make the image bigger than about 70pixels@2x it starts edging off

To change the color of unselected UITabBar icon in iOS 7?

北慕城南 提交于 2019-11-27 05:43:06
问题 I know this question has been asked earlier as well, but still i didn't get any solution searching the solution on internet. I referred the following posts: How can I change the text and icon colors for tabBarItems in iOS 7? Only able to change the selected icons color using tintColor . How to change the color of unselected tab bar items in iOS 7? In this they have written their own GozTabBar class inherited from UIView I want to changes the default gray color of UITabBar icon when its in

IOS 8 Tab Bar Item Background Colour

天大地大妈咪最大 提交于 2019-11-27 04:05:38
I've been trying to find the solution to this for the last week, and I have had no luck after trying every possible solution I could find or think of. Every solution I found and have attempted has either not worked, or been outdated. I have 5 UITabBarItem 's in a UITabBar placed within UITabBarController . I want to change the background color of the UITabBarItem when it is selected, and of course have it change back when the selected item changes. I am using Swift, and iOS SDK 8.3 in Xcode 6.3.1. If you can only answer in Objective-C that is fine too, any answer will help! Thank you all in

iphone app - detect which tab bar item was pressed

我与影子孤独终老i 提交于 2019-11-27 03:11:37
问题 i have a tab bar based application, with more than 5 tab bar items - so i get 4 of them directly showing in the view and the rest available by selecting the "More" tab. When a tab bar item is pressed, i want to detect which one was it. So, in the - (void)tabBarController:(UITabBarController *)tabBarCtrl didSelectViewController:(UIViewController *)viewController method, i use tabBarCtrl.selectedViewController.title to get the item's title. This works for the tabs visible in the view -that is

Setting badge value in UITabBarItem in UIViewController

 ̄綄美尐妖づ 提交于 2019-11-27 02:50:58
问题 I am adding UITabBarController to the window, and setting the viewControllers property of the UITabBarController to the array of ViewControllers. If i am setting the badge value inside the viewController then its working fine. self.tabBarItem.badgeValue = @"3"; But if i am setting the viewControllers property of the UITabBarController to the array of navigation controllers which is having view controller as the rootviewcontroller, then its not setting the badge value. Any suggestions ??

Changing tab bar item image and text color iOS

孤人 提交于 2019-11-27 02:50:32
Here is my tab bar: The following image shows the program being run and the "NEWS" item selected: It is clear the bar tint color is working fine as I want ! But the tintColor only affects the image and not the text. Also, when the an item is selected (as seen above, news) the item color goes blue! How do I prevent this from happening? I want it to stay white. Why is the text changing to a white color when selected but not when it is unselected? I basically want the item color and text color to be white all the time. How do I achieve this? Thanks for any help. Does it require swift code for

Is there a way to use a custom selected image for UITabBarItem?

北战南征 提交于 2019-11-27 00:49:27
问题 I like to have a custom selected image when a user selects an item on the tab bar, by default it selects as blue like but would like to have a green color instead. something like below any thoughts? 回答1: Just found my solution. Basically, I subclassed UITabItem and set this in the navigation controller: -(void) viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; CustomTabBarItem *tabItem = [[CustomTabBarItem alloc] initWithTitle:@"Events" image:[UIImage imageNamed:@"tabIcon.png"]

How to change inactive icon/text color on tab bar?

荒凉一梦 提交于 2019-11-26 23:56:03
How can I change inactive icon/text color on iOS 7 tab bar? The one in gray color. In every first ViewController for each TabBar: - (void)viewDidLoad { [super viewDidLoad]; // changing the unselected image color, you should change the selected image // color if you want them to be different self.tabBarItem.selectedImage = [[UIImage imageNamed:@"yourImage_selectedImage"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; self.tabBarItem.image = [[UIImage imageNamed:@"yourImage_image"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; } The clue of this code is