uitabbaritem

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

情到浓时终转凉″ 提交于 2019-12-17 06:24:13
问题 How can I change inactive icon/text color on iOS 7 tab bar? The one in gray color. 回答1: 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

How to manage tab bar item in running app in ios

↘锁芯ラ 提交于 2019-12-13 16:17:14
问题 I have created a storyboard with UITabbarController as initial rootViewController and added 6 items in tab bar Till here it is fine. now i need to manage tab bar items on following conditions : if user not logged in - remove 6th item if user logged in - remove 5th item I am able remove tab item in didFinishLaunchingWithOptions in AppDelegate by following code - (BOOL)application : (UIApplication *)application didFinishLaunchingWithOptions : (NSDictionary *)launchOptions { NSString

UItabBarItem highlight state image

痴心易碎 提交于 2019-12-13 03:25:35
问题 I'd like to be able to change the highlighted state image on an UITabBarItem when it is selected? Is it possible to subclass and access this? or do I need to roll my own navigation code? -> start edit I didn't articulate what I was looking for earlier. I am looking for the semi-transparent white overlay reference that the device adds to the selected state/image of the UITabBar. See image! http://solomon71.com/images/UITabBarItem.png 回答1: There is no documented or supported way to set your own

Swift disable tab bar item with function

老子叫甜甜 提交于 2019-12-13 03:15:36
问题 I have an item in my tab bar that shouldn't be enabled until certain conditions are met. I can disable that item in viewDidLoad() from my subclassed UITabBarController , but I'm having trouble creating a function that I can call when needed. Below is what I have so far - for reasons I don't understand, my tab bar item array is always nil! (Unless its initialized in viewDidLoad() where it works fine.) func setTabState(whichTab: Int) { let arrayOfTabBarItems = self.tabBar.items if let barItems

How to get rid of blink between switching Tab Bar Item

扶醉桌前 提交于 2019-12-12 22:21:27
问题 In my app I should use a several Tab Bar Item with one Controller. To approach this in my Second and Third Tab Bar Item Controllers I use self.tabBarController?.selectedIndex = 0 . As you can see this solution generates blink effect... It's happens every time when I choose Third Tab Bar Item. How to get rid of this blink? Any help is greatly appreciated! 来源: https://stackoverflow.com/questions/39487531/how-to-get-rid-of-blink-between-switching-tab-bar-item

Wrong size setSelectionIndicatorImage

心不动则不痛 提交于 2019-12-12 18:27:41
问题 Good day! I put a picture in a tab bar but it has wrong sizes. Help me solve the problem.I want to fill the entire Item. + (void)setupTabBarAppearance { [[UITabBar appearance] setBarTintColor:[UIColor colorWithRed:30.0f/255.0f green:201.0f/255.0f blue:224.0f/255.0f alpha:1]]; UIImage *image = [[self imageWithColor:[UIColor colorWithRed:255.0f/255.0f green:198.0f/255.0f blue:25.0f/255.0f alpha:1]] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 1, 2) resizingMode:UIImageResizingModeStretch]

iPhone instantiating a UITabBarItem programmatically

徘徊边缘 提交于 2019-12-12 18:17:33
问题 Try as I might, I cannot get this to work. Here is my latest attempt. Can someone clue me in as to why this does not work? In a method which is called by my view controller's init method: UIImage *image = [UIImage imageNamed: @"window22.png"]; UITabBarItem *item = [[UITabBarItem alloc] initWithTitle: @"Some Title" image: image tag: 0]; self.tabBarItem = item; All it does is put a big square where the image should be. The title in the tab bar remains the same as the view controller's title.

how to change disabled item color in TabBar in swift 3?

跟風遠走 提交于 2019-12-12 18:02:13
问题 I have a TabBar in my project and when user select item this item will disable but the color will change too! I want the color is same as other items color in TabBar I used item.isEnabled = false for disable item but this codes here won't work for this item override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) self.tabBar.barTintColor = UIColor.init(red: 126/255, green: 0/255, blue: 64/255, alpha: 1.0) if #available(iOS 10.0, *) { self.tabBar.unselectedItemTintColor

ios in-app purchase related crash

僤鯓⒐⒋嵵緔 提交于 2019-12-12 04:57:59
问题 I have a non consumable product to remove ads from my app, via in-app purchase. It works well sometimes, and if I close the app and open again, my code for detecting in NSDefaults if PRO version was purchased works fine. The things is, upon purchase, I want to remove the "upgrade to PRO" button from the tab bar and this code crashes the app. Here's the controller that handles in-app purchase: #import "RemoveAdsViewController.h" #import <StoreKit/StoreKit.h> #import "Flurry.h" #define

UITabBarItem Change Image Height and Width

柔情痞子 提交于 2019-12-12 02:33:38
问题 I have a UITabBarItem without a title and only an image. I was wondering how I can change the image size so it can take up the whole UITabBarItem. I searched all over the internet but found nothing. I tried: UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main_Storyboard" bundle:nil]; UITabBarController *tabBarController = [storyBoard instantiateViewControllerWithIdentifier:@"tab"]; UITabBar *tabBar = tabBarController.tabBar; UITabBarItem *tabBarItem1 = [tabBar.items