uitabbar

How to clip larger images to fit into tabBar icons in tabBarController built programmatically.

风格不统一 提交于 2019-12-05 05:01:18
I have created a tab controller programmatically. Now, I wanted to add images to the different tabs, for which I used : self.tabBarItem.image = [UIImage imageNamed:@"Sample_Image.png"]; The problem is Sample_image is larger in size than is required by tab. So just want to know how can I clip the image to fit into tabs. Sample_image is larger in size than is required by tab. Try this piece of code as this will resize the required image and return an UIImage instance with 30x30 size (size required for UITabbar ). UIImage *image = [UIImage imageNamed:@"Sample_Image.png"]; self.tabBarItem.image =

iOS 7: UITabBarItem badge z-index

不羁岁月 提交于 2019-12-05 03:59:46
I'd like to show a UITabBarItem badge above the selectionIndicatorImage . There are 3 screenshots: Screenshots Light gray color is the selectionIndicatorImage . Yes, badge looks good. When I touch up inside at the cloud icon UITabBar become: It's wrong.. I'd like to show badge above the selection image. If there is no icon for UITabBar - it looks good. How can I fix this issue? Thanks in advance. Edited I add icons in the storyboard. For badge I've made the code: UITabBarItem *cartTabBarItem = (UITabBarItem *)[self.tabBarController.tabBar.items objectAtIndex:3]; if ([[DataSourceWrapper

setting tint color for selected tab in UITabBar

流过昼夜 提交于 2019-12-05 03:27:05
In Xcode 5 Dev Preview 2, I was able to execute the following: [[UITabBar appearance] setTintColor:[UIColor whiteColor]]; //the color of the selected image and text (white) In Xcode 5 Dev Preview 3, the same line of code throws an exception (see below). The exception indicates that I may want to use ' barTintColor ' - but I do not - as this is the color of the overall UITabBar. How can I set the color of the selected image and text in a UITabBar? The new exception in Xcode 5 Dev Preview 3: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-setTintColor: is

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],

UITabBar displays UITabBarItem image ignoring rendering mode AlwaysOriginal

你。 提交于 2019-12-05 02:36:55
问题 With the release of tvOS 9.1 and Xcode 7.2, my UITabBarItem images are being displayed incorrectly. In my view controllers, I set the tabBarItem.image and tabBarItem.selectedImage with images using UIImageRenderingMode.AlwaysOriginal . required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) self.tabBarItem.image = UIImage(named: "myTabImage")?.imageWithRenderingMode(.AlwaysOriginal) self.tabBarItem.selectedImage = UIImage(named: "myTabImageSelected")?.imageWithRenderingMode(

iPhone : Custom tabbar without the awful More menu

…衆ロ難τιáo~ 提交于 2019-12-05 02:24:06
问题 So i wanted to build a tabbar that has more than 5 items and is scrollable and found this article. Easy done by subclassing the UITabBarController and hide the existing tabbar: for(UIView *view in self.view.subviews) { if([view isKindOfClass:[UITabBar class]]) { view.hidden = YES; break; } } Then i just add a UIScrollView and throw some buttons in there based on the items-collection of the tabbarcontroller. int i = 0; for (UITabBarItem *item in self.tabBar.items) { UIView *tab = [[[UIView

How to apply a gradient on a UI Tab Bar In Swift?

微笑、不失礼 提交于 2019-12-05 01:03:19
问题 I built the tab bar through the storyboard, and to customise the colour I change it in the app delegate, with UITabBar.appearance().barTintColor = Color , I have a gradient method which is this: func setGradientBackground(colorOne: UIColor, colorTwo: UIColor) { let gradientlayer = CAGradientLayer() gradientlayer.frame = bounds gradientlayer.colors = [colorOne.cgColor, colorTwo.cgColor] gradientlayer.locations = [0, 1] gradientlayer.startPoint = CGPoint(x: 1.0, y: 0.0) gradientlayer.endPoint =

Tab bar controller inside a navigation controller, how to push new viewcontrollers to the tabcontroller?

浪尽此生 提交于 2019-12-04 21:31:43
Design requirement: Show a list of items the user can pick from After having picked an item, bring the user to a new view with a back button. The new view should contain a list of tabs at the bottom that are not present in the first screen When clicking an item in the tabs, a new screen should appear with a back button and the tabs should still be visible at the bottom. Clicking a tab should take the user back up the hierarchy to #2. Not to the first screen. I have tried following structure: UINavigationController UIViewController with a UITableView UIViewController with a UITabBar (like here

How to prevent view resizing/transform when UINavigationBar hides/shows

跟風遠走 提交于 2019-12-04 21:29:07
问题 I have an application with a tab bar and a navigation bar. I push a view controller that is used to show photos, one at a time. It initially shows the bars and forward/back controls; after a delay, these hide, using setNavigationBarHidden:animated: and a custom transform ( CGAffineTransformMakeTranslation ) on the tab bar. This works, but the view controllers view , which shows the photo, leaps up and down. The same is true if I leave the tab bar out of the equation. How can I prevent the

Tab bar icons on retina display

◇◆丶佛笑我妖孽 提交于 2019-12-04 19:52:36
问题 I am making an iPhone App but I can't understand why my custom tab bar icons are pixelated. They are 30x30. If I change the resolution to 60x60, for example, the icons are still pixelated but they are also incomplete. Can you help me to fix this problem? Thank you very much. 回答1: You don't need to double the size of your non-retina images. You need to create two separate icons icon.png (30x30) and icon@2x.png (60x60). iOS will automatically load the right file based on the screen scale. You