uitabbaritem

Set UITabBarItem title programmatically?

拈花ヽ惹草 提交于 2019-12-22 05:23:17
问题 My app is based on a tab bar architecture. In order to have an easy internationalisation mechanic, I do not write any string in XIB files. viewdidload permits to change programmaticaly the strings in the views. When my app launches, I can see the 4 tabs. But in fact only the first one loads its view controller. The others wait for user click to be loaded. Tabs title can be changed using [self setTitle:@"Mouhahaha"]; in viewDidLoad of loaded view controller. If I want to keep my

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

陌路散爱 提交于 2019-12-22 03:22:51
问题 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 {

Configuring a UITabBar with more than 16 items

被刻印的时光 ゝ 提交于 2019-12-21 20:23:38
问题 My UITabBarController contains more than 16 view controllers. When I go in the "More" tab, I can see all the UITabBarItems . If I click the "Edit" button, I can see the 16 first icons, but there is not enough room to display more, so starting from the 17th item, the icons are only partially displayed. Starting from the 21st item, the icons are not displayed at all. And it is not possible to access the rest of the icons with a scroll bar. By the way, this question gives a theoretical answer to

iPhone UITabbar item double-click pops controllers

此生再无相见时 提交于 2019-12-21 13:08:06
问题 just found out something: If you have a Tabbar combined with a NavigationController (that has some views on it's stack) and you double click the TabBarItem, the view pops to the first ViewController, whether you like it or not. Is there a way to prevent this? 回答1: You probably should not prevent this behavior. It's a standard iPhone UI convention, like tapping the status bar to scroll to the top of a scroll view. If you really want to do it, you should implement the UITabBarController

UITabBarController: UITabBarItem Updating it or Reloading it

半世苍凉 提交于 2019-12-21 05:36:08
问题 How do I update or reload the text color on the UITabBarItem? It will, only if I kill the app and re-open again. Then it will refresh the textColor on the UITabBarItem Swift 5.1, iOS 12 func handleRefreshForTabBar() { DispatchQueue.main.async { //Background self.view.backgroundColor = Theme.current.generalBackground //Images self.tabBar.tintColor = Theme.current.tabTintColor //Bar self.tabBar.barTintColor = Theme.current.tabBarTintColor } } override func viewWillAppear(_ animated: Bool) {

Adding a UITabBar and tabbaritems to the UITabBar through code ( NOTE: I don't want to implement TabBarController )

余生颓废 提交于 2019-12-21 04:53:43
问题 I have searched a lot and beleive me i have come across many questions and sample codes but none of them fit my requirement , it's crazy how can there not be an answer for this. My requirements specifically:- 1. I want a UITabBar not a UITabBarController 2. I want it to be on the top-right corner of my UIView 3. I want two tab bar items on it( need not be assiciated with two view controllers) Now what i did was UITabBar *myTabBar=[UITabBar alloc]initWithFrame:myTabFrame]; [self.view

How to move title of UITabBarItem?

北慕城南 提交于 2019-12-21 03:45:29
问题 Can somebody tell me please how can I move title of UITabBarItem for example 2px to top? 回答1: Solution: UITabBarItem *item = [tabBar.items objectAtIndex:0]; item.titlePositionAdjustment = UIOffsetMake(0, -5.0); 回答2: Update for Swift 3 Put this code inside UITabBarController : UITabBarItem.appearance().titlePositionAdjustment = UIOffset(horizontal: 0, vertical: -5) Credit goes to Tim Brown 回答3: Swift 4 Like me, if you are creating tab bar controller inside some other controller just after

iOS : How to add Underline in UITabBarItem

有些话、适合烂在心里 提交于 2019-12-21 01:57:41
问题 I am working in a application where i need to add underline in UITabbarItem . so i would like to add underline under the selected UITabbarItem in Default UITabbarcontroller of iOS. I have already created subclass of UITabbarcontroller but didn't find any way to add line in that. I want to do something like below image. If anyone have any idea for this please share here. 回答1: Please try this one. I have used in my application once and hope it will help you too. This is how I have created Tab

How to adjust tab bar badge position?

江枫思渺然 提交于 2019-12-19 06:03:24
问题 I'm displaying badge on tab bar but when number increase it goes out to tab bar item like shown in image I want to move the badge view slightly left so it fit on selected tab image.i tried as described here but no luck. So is there is any way to adjust badge view position?Any help would be appreciated. 回答1: I found Kateryna's answer to be useful in putting me on the right track, but I had to update it a little: func repositionBadge(tab: Int){ for badgeView in self.tabBarController!.tabBar

Prevent tabbar from changing tab at specific index - IOS

不羁岁月 提交于 2019-12-19 05:13:37
问题 Thanks for reading my question. I'm trying to implement a popup menu when a user clicks the tab with the index of 4. So I'm trying to prevent the tabbar from switching viewcontroller when index 4 is pressed. Here is my code: - (BOOL) tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController { if(viewController == [tabBarController.viewControllers objectAtIndex:4]){ NSLog(@"NO"); return NO; }else{ NSLog(@"YES"); return YES; } } I've