uitabbaritem

iOS Tab Bar icons keep getting larger

喜夏-厌秋 提交于 2019-11-27 20:04:41
I am having a problem with my icons in my tabBar . Tapping the same tab bar button repeatedly will keep increasing the tab bar icon's size. If I push a different one, it goes back to its original size. Any ideas what I should fix? As per the project shared by the OP ( see question comments ), it seems the tab bar image insets seem to be messing things up. Steps to resolve the issue: Select the tab bar item of the problematic ViewController s in IB Go to Size Inspector section ( on the right ) Ensure your image insets are balanced If you give 5px inset to top then balance with a -5px inset to

Xcode Tabbed Application - Adding New Tab view

不想你离开。 提交于 2019-11-27 18:47:17
I'm working with Xcode 4.2. I started to work with Tabbed Application and now I want to add 3rd and 4th Tabbed to story board on my application. How Can I add it? I try to use it but I cannot. :( I didn't get good tutorials for it. Does anyone have any idea how to do this? I went through this link , but I need to add 2 more Tabbed views to first view. Update: Just go and create Tabbed Application and they try to add one or two more tab view. I'm still trying it. But I can't. Jamie Just add two more view controllers to your project, and then control drag from the tab bar controller to the view

Is it possible to change UITabBarItem badge color

你。 提交于 2019-11-27 18:46:28
I want to change background color of UITabBarItem badge but can't find any resource on how to make it. UITabBarItem has this available since iOS 10. var badgeColor: UIColor? { get set } It's also available via appearence. if #available(iOS 10, *) { UITabBarItem.appearance().badgeColor = .green } reference docs: https://developer.apple.com/reference/uikit/uitabbaritem/1648567-badgecolor Changing the badge-color is now natively supported in iOS 10 and later using the badgeColor property inside your UITabBarItem . See the apple docs for more infos on the property. Example: Swift 3: myTab

Is it possible to customize UITabBarItem Badge?

為{幸葍}努か 提交于 2019-11-27 16:43:09
问题 The question below is similar as mine. How to use a custom UIImage as an UITabBarItem Badge? Is it possible to use a background image instead of drawing it myself? I think it's fine since my app will only use a 1-digit badgeValue. If it is not really possible, I want to know if we can change the badge color instead. The answers in the question below are not really helping. Is it possible to change UITabBarItem badge color 回答1: This is your best bet. Add this extension at the file scope and

Increment tab bar badge w/ UIAlertAction swift?

霸气de小男生 提交于 2019-11-27 14:53:31
@IBAction func addToCart(sender: AnyObject) { let itemObjectTitle = itemObject.valueForKey("itemDescription") as! String let alertController = UIAlertController(title: "Add \(itemObjectTitle) to cart?", message: "", preferredStyle: .Alert) let yesAction = UIAlertAction(title: "Yes", style: UIAlertActionStyle.Default) { (action) in var tabArray = self.tabBarController?.tabBar.items as NSArray! var tabItem = tabArray.objectAtIndex(1) as! UITabBarItem let badgeValue = "1" if let x = badgeValue.toInt() { tabItem.badgeValue = "\(x)" } } I don't know why I can't just do += "(x)" Error: binary

How to set UITabBarItem's unselected tint, ***including system items*** (iOS7)

半世苍凉 提交于 2019-11-27 13:10:06
问题 ( NOTE: I see there are several similar questions on SO, but none of them seem to get at my specific issue of wanting to change the unselected appearance of both custom and system UITabBarItems.) I'm working in iOS7. I have a UITabBar with some buttons. Some of them are my buttons, some are system buttons. Example: UITabBarItem *searchButton = [[UITabBarItem alloc] initWithTabBarSystemItem: UITabBarSystemItemSearch tag: navSearchItem]; UITabBarItem *bookMkButton = [[UITabBarItem alloc]

ios 11 UITabBar UITabBarItem positioning issue

人盡茶涼 提交于 2019-11-27 11:33:27
I have built my app using new Xcode 9 beta for ios 11. I have found an issue with UITabBar where items are spread through the UITabBar and title is right aligned to the image. I have tried changing the code to get it to work but still not successful. ios 10+ ios 11 I could change the position of title using tabBarItem.titlePositionAdjustment But that is not my requirement as it should automatically come bellow the image itself. I tried setting tabbar.itemPositioning to UITabBarItemPositioningCentered and also tried changing itemSpacing and width , but still did not work. Can someone help me

How can I change the text and icon colors for tabBarItems in iOS 7?

99封情书 提交于 2019-11-27 10:41:54
How can I change the text and icon colors for UITabBar and UITabBarItems in iOS 7? The default gray text seems dim and hard to read for unselected tabbar items. Ed Fernandez There are two things you need to do for this: 1) If you want to customize the TabBar itself, you need to set the barTintColor for the tabBarController: // this will generate a black tab bar tabBarController.tabBar.barTintColor = [UIColor blackColor]; // this will give selected icons and text your apps tint color tabBarController.tabBar.tintColor = appTintColor; // appTintColor is a UIColor * 2) Set the tabBarItem text

Set custom images to the UIBarButtonItem but it doesn't show any image

人走茶凉 提交于 2019-11-27 09:45:49
I want to set custom images to the UIBarButtonItem but it only shows a rectangular box around and It doesn't show the actual image. func setupBrowserToolbar() { let browser = UIToolbar(frame: CGRect(x: 0, y: 20, width: self.view.frame.width, height: 30)) //配置返回组件 let path = NSBundle.mainBundle().pathForResource("back", ofType: "png") let urlstr = NSURL(fileURLWithPath: path!) let data = NSData(contentsOfURL: urlstr) let btnback = UIBarButtonItem(image: UIImage(data: data!), style: UIBarButtonItemStyle.Plain, target: self, action: Selector("backClicked:")) //分割按钮1 let btngrap1 = UIBarButtonItem

Objective-C: How to properly set didSelectViewController method for TabBarController, so I can refresh the VC everytime it is tapped

给你一囗甜甜゛ 提交于 2019-11-27 08:30:35
问题 Trying to accomplish Tap on the tabbaritem and it will called the respective method on the tabbaritem VC . Issue When I tap on tabbaritem2 it will call didSelectViewController on tabbaritem2 and then the respective method. Then when I tap on tabbaritem3 it will still call the didSelectViewController on tabbaritem3 and the respective method. But when I switch back and tap on tabbaritem2 . It will still call the didSelectViewController on tabbaritem3 and not didSelectViewController on