uitabbaritem

Custom UITabBar unselected item's color

可紊 提交于 2019-12-06 05:54:29
I am trying to change the default grey colour of the unselected UITabBarItems. I have managed to change the text but not the image. TabBar.appearance().barTintColor = UIColor(red: 86.0/255.0, green: 132.0/255.0, blue: 208.0/255.0, alpha: 1.0) var normalTint: UIColor = UIColor.whiteColor() TabBar.appearance().tintColor = UIColor.whiteColor() UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: normalTint,NSFontAttributeName: UIFont(name: "Arial", size: 13)!], forState: UIControlState.Normal) you can use .AlwaysOriginal tabBarItem.selectedImage = UIImage(named:

How to change tabbar icon color from default blue?

和自甴很熟 提交于 2019-12-05 23:25:37
问题 I have got four tabs. I was able to change the tab icon color from default blue to red (or probably any color) and it works perfectly fine. The problem is it works only for three tabbaritems and last one is default blue. Below is the code. I'm coding this in rootviewcontrollerAppDelegate.m You could try this by pasting the below code in your appdelegate. Could you guys help me out I'd be so greatful! @implementation UITabBar (ColorExtensions) - (void)recolorItemsWithColor:(UIColor *)color

Unable to access index of tabBar item using swift

浪子不回头ぞ 提交于 2019-12-05 18:18:02
问题 Environment: xcode 6GM, Language Swift. I was setting image color of a tabBar item using this code in xcode 6 beta2 var cameraTab : UITabBarItem = self.tabBar.items[1] as UITabBarItem But now in xcode 6GM it is giving error. Error: [AnyObject]? does not have a member named 'subscript' 回答1: items is Optional - you can do: if let items = self.tabBar.items { println("\(items[1])") } or var cameraTab : UITabBarItem = self.tabBar.items![1] as UITabBarItem 回答2: items property is optional for tabBar

Tab bar not showing icons?

一笑奈何 提交于 2019-12-05 11:26:29
问题 I read a bunch of related questions, I tried what they said, nothing works really. Not sure why. So, I have 3 different UIStoryboards . First one is the Auth Storyboard that handles Login/Register and there's a storyboard reference to the second Storyboard - Tab bar storyboard. This storyboard contains 5 other storyboard references that would load it's separate view controllers. My problem is that the icons are not showing once the user is logged in. I setup a custom color of the first view

why does selecting a tabbarController index programatically doesnt call delegate method

懵懂的女人 提交于 2019-12-05 09:40:58
when we touch the tabbaritem of the tabbarcontroller the delegate methods are called: -(BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController; - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController; but when try to do the same thing programmatically, i.e. [self.tabbarController setSelectedIndex:selectedIndexNo]; or [self.tabBarController setSelectedViewController:[self.tabBarController.viewControllers objectAtIndex:0]]; the delegate methods are not called.

Custom action when clicking on UITabBarController

大憨熊 提交于 2019-12-05 08:01:49
I have a Tab Bar Controller with four navigation controllers added to it. The navigation controllers appear as Tab Bar Items in the Tab Bar Controller. Now I want to add a fifth button to the tab bar, that does not open another view, but triggers some custom code. I want to display an overlaying "share menu" when clicking that Tab Bar Item regardless on which of the four pages the user is. How can I do that? I can suggest to add dummy UIViewController to the last index and handle UITabBarControllerDelegate - (BOOL)tabBarController:(UITabBarController *)tabBarController

UITabBarItem title position

旧巷老猫 提交于 2019-12-05 05:38:14
On searching the web on how to adjust the position of a UITabBarItem title position i ran over this similar post and still wondering how to do that. Is it even possible to adjust the title position a bit from the bottom up? (for example 5px) I need this because i have custom images and now the position of the title is not perfect. Why don't you just have an empty title property for your view controller and add the title to your custom images for the tab? You can do this (in iOS 5.0): UIImage* iconSelected = [UIImage imageNamed:@"tabIconSelected.png"]; UIImage* iconNotSelected = [UIImage

Changing selected TabBarItem font iOS

六月ゝ 毕业季﹏ 提交于 2019-12-05 03:19:39
I have a TabBar. I am trying to style it so that the titles on the TabBarItems have different fonts for the normal state and the selected state. For normal state I want Helvetica Neue Light and for the selected state I want Helvetica Neue Medium. No matter what I do, I can't seem to get the fonts to be different for these two states. The color changing works fine. Here is what I currently have: // Set the tab bar title appearance for normal state. [[UITabBarItem appearance] setTitleTextAttributes:@{ NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue-Light" size:16],

UITabBarItems in UITabBar show after I click the item not when application launches

守給你的承諾、 提交于 2019-12-05 00:59:46
This application I'm writing has a problem. I'm setting up the UITabBar in my application window and set the icons in the view files. But when i run the app, the first icons show up (because the view is loaded I guess) and the other icons do not show up until I click them. Do i need to implement self.tabBarItem in some other method not viewDidLoad ? Thanks in advance to everyone! - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { tabBar = [[UITabBarController alloc] init]; SubscriptionsController *subscriptionsController = [

setTitleTextAttributes doesn't work for UITabBarItem when it is unselected in swift

微笑、不失礼 提交于 2019-12-04 18:51:29
I am trying to custom my UITabBarController . I have it embedded in my UIViewController , I also created a class for this UITabBarController . override func viewDidLoad() { super.viewDidLoad() //custom tab bar self.tabBar.barTintColor = UIColor(red: 0.0/255.0, green: 102.0/255.0, blue: 153.0/255.0, alpha: 1) self.tabBar.tintColor = UIColor(red: 171.0/255.0, green: 203.0/255.0, blue: 61.0/255.0, alpha: 1) self.tabBarItem.setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.whiteColor()], forState:UIControlState.Normal) self.tabBarItem.setTitleTextAttributes(