uitabbaritem

How to refresh Tab Bar Items in swift ios

痴心易碎 提交于 2021-02-07 13:14:09
问题 I do app like Instagram with tab bar items. In app I have simple user and company user . I have main ViewController: MainTabBarController: UITabBarController with 5 tab bar items. And each item has own ViewController I need refresh MainTabBarController when user is Simple user it is 5 items and when user is Company user it is 4 items. How to refresh or reload without close app? One solution I already do with UserDefaults, but need close app. Platform iOS > 9.0, Swift 3.0 回答1: Use

How to refresh Tab Bar Items in swift ios

那年仲夏 提交于 2021-02-07 13:12:44
问题 I do app like Instagram with tab bar items. In app I have simple user and company user . I have main ViewController: MainTabBarController: UITabBarController with 5 tab bar items. And each item has own ViewController I need refresh MainTabBarController when user is Simple user it is 5 items and when user is Company user it is 4 items. How to refresh or reload without close app? One solution I already do with UserDefaults, but need close app. Platform iOS > 9.0, Swift 3.0 回答1: Use

Swift -Tabbar item frame is returning questionable value when converting frame to window

我的未来我决定 提交于 2021-01-29 17:22:48
问题 I have a tabBar with 5 items. To get the frame of the first tabBar item and set something based on that frame I use this which works perfectly: guard let firstTab = tabBarController?.tabBar.items?[0].value(forKey: "view") as? UIView else { return } guard let window = UIApplication.shared.windows.filter({$0.isKeyWindow}).first else { return } let windowRect = lastTab.convert(firstTab.frame, to: window) print(firstTab) // (2.0, 1.0, 79.00000000298023, 48.0) print(windowRect) // (4.0, 689.0, 79

Programmatically assign view controller to tab bar controller

夙愿已清 提交于 2021-01-28 07:08:21
问题 I am fairly new to swift and am trying to create a movie database application using TMDB from Apiary. I have created the layout of the view controllers for one category. However, I am planning to have multiple categories, the but only difference between them is the data I retrieve from the API. For example "now_playing" key gets the now playing list and the "top_rated" key gets the top rated list of movies. When I was initially doing this I created the tab bar controller in AppDelegate.swift

Select a tab bar item programmatically (not using UITabBarController)

妖精的绣舞 提交于 2020-05-26 10:16:46
问题 I have a view derived from UIViewControler (not UITabBarController). In this view I added a tab bar with several tab bar items. I used the UITabBarDelegate to allow the view to do something when users tap on each tab bar item. class MyViewController: UIViewController, UITabBarDelegate { func tabBar(tabBar: UITabBar, didSelectItem item: UITabBarItem!) { // do something } } My question is how we can programmatically select the first tab bar item when the view is first loaded? Note that I would

Hide tab bar item and aligning other tab items

旧城冷巷雨未停 提交于 2020-02-01 04:39:08
问题 In my app, i have 4 tab bar items. Iam adding these 4 tab bar items in XIB file. Initially i have to show 3 tab bar items and after sync i have to show 4th tab bar item in my app. So for this, i am hiding 4th Tab bar item using following code. [[[self.tabBarController.tabBar subviews] objectAtIndex:03 setHidden:YES]; The tab item is hiding but i am having blank space in place of the hidden item. Is there any chance to align other 3 items in full tab bar. The thing is i dont want to show blank

Unable to see controller added to UITabBar programmatically swift

谁都会走 提交于 2020-01-24 22:55:11
问题 I added 2 tabBar items from storyboard and one UITabBarItem - Menu programmatically. I am successfully able to open the controllers corresponding to tabBarItems which I created using storyboard. However, when I click on "Menu" a blank black screen appears, @objc public class MainScreenTabsController : UITabBarController { public override func viewDidLoad() { super.viewDidLoad() let tabController = MyViewController() let tabBarItem = UITabBarItem(title: "Menu", image: UIImage(named: "more

Can i only display text in tab bar item and change the style and position

我们两清 提交于 2020-01-17 09:12:16
问题 I add a tab bar in storyboard, and do not want to set an image to the tab bar item, and like the following: How can I change the font and the position for the title of the bar item in storybord? 回答1: First select the tab bar item in storyboard, than in Attributes Inspector set System Item and Title Position to Custom, so you will be able to change the position of the title by setting values to Horizontal and Vertical boxes. Finally, to change the font, in your viewDidLoad() , include: