uitabbaritem

Preserving the original image color of the selected and unselected UITabBar icons

巧了我就是萌 提交于 2019-11-30 17:23:52
The structure is the following: In my storyboard, I have a Tab Bar Controller which contains a Tab Bar object. This object has a custom class in which I have only this method: - (void)awakeFromNib { NSArray *imageNames = @[@"test1", @"test2", @"test3", @"test4", @"test5"]; for (int i=0; i<5; i++) { UITabBarItem *item = [self.items objectAtIndex:i]; NSString *imageName = [imageNames objectAtIndex:i]; item.image = [[UIImage imageNamed:imageName] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; item.selectedImage = [UIImage imageNamed:[imageName stringByAppendingString:@"-selected"]];

Sliding UITabBarItems in UITabBarController

戏子无情 提交于 2019-11-30 08:48:18
问题 I have a UITabBarController as my rootController with 8 UITabBarItems . and I want to show just 4 UITabBarItems in my screen. By default all my other tab bar items appear in a small tabBarItem called "More" and you can select the other 4. But I have seen some apps that implement a sliding UITabBarItems with a slide icon instead of a "More" icon. How can I show just 4 at a moment, and I slide the TabBarItems, and so that I can select the other tab bar items ? ~ Something like this ~ And then I

Simple Title not showing up in UINavigationController

偶尔善良 提交于 2019-11-30 05:08:47
问题 I have looked at all of the similar/related questions, but none either a) are exactly my problem or 2) the solutions just don't work. In my appDelegate.m I have in didFinishLaunchingWithOptions JCGRootNavigationController *rnc = [[JCGRootNavigationController alloc] init]; self.window.rootViewController = rnc;` JCGRootNavigationController is a subclass of UINavigationController @interface JCGRootNavigationController : UINavigationController` In JCGRootNavigationController.m: @implementation

Is it possible to remove the images in the UITabBarItem and aligned vertically the title

可紊 提交于 2019-11-30 03:51:51
问题 I have a UITabBar but i don't want to set the images I just want to set the title, and I want this title to be aligned vertically. Is this possible? Thanks 回答1: Not that I know of. I think you'd need to create images of your text labels (either in advance in your graphic tool of choice, or you can create them programmatically at runtime). If you want to do it programmatically, a method like the following might do it. It creates a center-aligned image using the text you pass it, performing

Change tintColor of unselected UITabBarController item title and background image

故事扮演 提交于 2019-11-30 03:19:47
How can I change the tintColor of an unselected UITabBarItem title and background image iOS 8? The default color for an unselected state is a light gray color, but it does not show on my darkish shade UITabBar background I'd like my unselected state to have a color of [UIColor blackColor] Inside my app delegate didfinishlaunchingwithoptions: I have UIImage *deselectedE = [[UIImage imageNamed:@"mincraft_axe_green_32.png"] imageWithRenderingMode:UIImageRenderingModeAutomatic]; UIImage *selectedE = [[UIImage imageNamed:@"mincraft_axe_green_32.png"] imageWithRenderingMode

ios tabbar put text in the middle when no image

醉酒当歌 提交于 2019-11-30 01:49:15
问题 My tabbar consists only of text, no images. The problem is that the text always show on the bottom of the tab, is there a way to position the text in the middle ? Thank you 回答1: Got it! [tab.tabBarItem setTitlePositionAdjustment:UIOffsetMake(0, -10)] 回答2: A supplement, if you set multi viewControllers in tabBarController, you should use the following: for (UITabBarItem* item in tabBarController.tabBar.items) { [item setTitlePositionAdjustment:UIOffsetMake(0, -10)]; } 回答3: swift update. func

How can I find the UIView for a specific UITabBarItem?

大憨熊 提交于 2019-11-30 01:41:38
问题 I am using an external library called SwiftyWalkthrough, which allows me to expose only certain views on the screen to guide a new user through my app's UI. The first item I want exposed to the user is a UITabBarItem. I need to find the UIView associated with that specific UITabBarItem. I know the index for the item, and I have given it a tag. But I haven't found a way for them to help me find the view. Of course, I only want to use public interfaces to accomplish this. 回答1: I solved my

Deselect or unselect all tabs in tabbar in iOS 5

我们两清 提交于 2019-11-29 21:03:15
问题 I am new to iOS development and I have started with IOS 5 directly. I have created a storyboard which consists of a tabview controller as its rootviewcontroller. I have put 2 tabs to it. I want to deselect/unselect all the tabs initially. How do I do this? I have tried the following UIView *view = [[UIView alloc]initWithNibName:@"view" bundle:[NSBundle mainBundle]]; [self.tabBarController setSelectedViewController:nil]; [self.tabBarController setSelectedViewController:view]; where I have

How to properly customize UITabBar and UITabBarItem on iOS 7 and iOS 8?

偶尔善良 提交于 2019-11-29 17:22:58
问题 I am googling around so much, but nowhere I find a straight and consolidated answer. I want to customize my UITabBarController such that: the UITabBar itself is completely black the text color of the item titles is white in non-highlighted state the text color of the item titles is red in highlighted state Use multicolored icons in the tab bar 1. Turn UITabBar black I am guessing I need to use the UIAppearance API for this, and actually I was able to turn the UITbarBar black using: [[UITabBar

Swift - How to change UITabBarItem badge font?

喜你入骨 提交于 2019-11-29 10:43:17
I have a UITabBar . I set a value for tab bar items: tabBarItem3?.badgeValue = String(self.numberOfProducts) Now I want to change its font to a specific font. Then I used this code : tabBarItem3?.setBadgeTextAttributes([NSFontAttributeName: UIFont(name: "IRANSans", size: 14)], for: .normal) It doesn't work. What should I do? Swift 3 UITabBarItem.appearance().setBadgeTextAttributes([NSFontAttributeName: UIFont(name: "IRANSans", size: 14)], for: .normal) UITabBarItem.appearance().setBadgeTextAttributes([NSFontAttributeName: UIFont(name: "IRANSans", size: 14)], for: .selected) UIKit updates the