Yalantis / FoldingTabBar.iOS

Folding Tab Bar and Tab Bar Controller
https://yalantis.com
MIT License
3.68k stars 458 forks source link

The FoldingTabBar is not displayed when using performSegue, The bar is shown but in black #76

Open resand opened 7 years ago

resand commented 7 years ago

The more information you provide, the faster we can help you.

Report a bug

When changing from a ViewController login -> home, the tab becomes dark in black.

What did you do?

self.performSegue(withIdentifier: "SegueHome", sender: self)

Your Environment

   CocoaPods : 1.2.0
        Ruby : ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
    RubyGems : 2.0.14.1
        Host : Mac OS X 10.12.3 (16D32)
       Xcode : 8.2.1 (8C1002)
         Git : git version 2.10.1 (Apple Git-78)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ 76c671e17a5d0ede8ea467d95e453fd7dd8659eb

Installation Source

Executable Path: /usr/local/bin/pod

Plugins

cocoapods-deintegrate : 1.0.1
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.1.2
cocoapods-try         : 1.1.0

Podfile

target 'App' do
    use_frameworks!
    pod 'FoldingTabBar', '~> 1.1'
end

Image the bug

901a7a3c-e3cd-11e6-99e4-f7618986c755

dineshguptha commented 7 years ago

I am also faced this issue and I made tab bar as a root view controller instaed of segue so its working without any black screen.

resand commented 7 years ago

@dineshguptha I also have it as a start, but I use a login screen and it is redirected based on the state, how did you solve it?

lovincyrus commented 7 years ago

Facing the same issue here.

@resand Just trying to shed some light here to:

Attempted to set up a viewController and points segue way to YALFoldingTabBarController. Since the didFinishLaunchingWithOptions of AppDelegate.m has [self setupYALTabBarController], in the (void)setupYALTabBarController:

In AppDelegate.m: YALFoldingTabBarController tabBarController = (YALFoldingTabBarController ) self.window.rootViewController;

Obviously, the app will begin with the YALFoldingTabBarController because it was set as the self.window.rootViewController.

I tried to create a LoginViewController -> Embed a Navigation Controller -> Set initial View Controller -> set Segue way push to the Tab Bar Controller. (src)

Technically, this should work. But, it won't, because in the AppDelegate of the library, it was set as the rootViewController.

If somebody knows how to get around it or modify the AppDelegate by not setting (YALFoldingTabBarController *) as self.window.rootViewController, appreciate it.

dineshguptha commented 7 years ago

until user should login my root view controller is loginViewController (super class of view controller) and after that I am making tab bar as root view contrroller like this ... just I am using this method instaed of performing segue .my app has 5 tabs so am creating 5 YALTabBarItems.

-(void)setUpCustomTabBar {

AppDelegate *appDelegateTemp = (AppDelegate *) [[UIApplication sharedApplication]delegate];
UITabBarController* rootController = [[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"loginToHomeViewController"];
appDelegateTemp.window.rootViewController = rootController;

YALFoldingTabBarController *tabBarController = (YALFoldingTabBarController *) appDelegateTemp.window.rootViewController;

//prepare leftBarItems
YALTabBarItem *item1 = [[YALTabBarItem alloc] initWithItemImage:[UIImage imageNamed:@"home_loading_home_icon_off"]
                                                  leftItemImage:nil
                                                 rightItemImage:nil];

YALTabBarItem *item2 = [[YALTabBarItem alloc] initWithItemImage:[UIImage imageNamed:@"home_search_btn_unselector-1"]
                                                  leftItemImage:[UIImage imageNamed:@"home_search_btn_unselector-1"]
                                                 rightItemImage:nil];

tabBarController.leftBarItems = @[item1, item2];

//prepare rightBarItems
YALTabBarItem *item3 = [[YALTabBarItem alloc] initWithItemImage:[UIImage imageNamed:@"chat_camera_icon_off"]
                                                  leftItemImage:[UIImage imageNamed:@"chat_camera_icon_off"]
                                                 rightItemImage:[UIImage imageNamed:@"chat_camera_icon_off"]];

YALTabBarItem *item4 = [[YALTabBarItem alloc] initWithItemImage:[UIImage imageNamed:@"home_heart_btn_unselector-1"]
                                                  leftItemImage:nil
                                                 rightItemImage:nil];

YALTabBarItem *item5 = [[YALTabBarItem alloc] initWithItemImage:[UIImage imageNamed:@"home_users_btn_unselector-1"]
                                                  leftItemImage:nil
                                                 rightItemImage:nil];

tabBarController.rightBarItems = @[item3, item4];

tabBarController.centerButtonImage = [UIImage imageNamed:@"chat_camera_icon_off"];

tabBarController.selectedIndex = 0;

//customize tabBarView
tabBarController.tabBarView.extraTabBarItemHeight = YALExtraTabBarItemsDefaultHeight;
tabBarController.tabBarView.offsetForExtraTabBarItems = YALForExtraTabBarItemsDefaultOffset;
tabBarController.tabBarView.backgroundColor = [UIColor colorWithRed:94.f/255.f green:91.f/255.f blue:149.f/255.f alpha:1.f];
tabBarController.tabBarView.tabBarColor = [UIColor colorWithRed:72.f/255.f green:211.f/255.f blue:178.f/255.f alpha:1.f];
tabBarController.tabBarViewHeight = YALTabBarViewDefaultHeight;
tabBarController.tabBarView.tabBarViewEdgeInsets = YALTabBarViewHDefaultEdgeInsets;
tabBarController.tabBarView.tabBarItemsEdgeInsets = YALTabBarViewItemsDefaultEdgeInsets;

}

mohammadtakbiri commented 7 years ago

@dineshguptha you save a lot of my time .... and i thank you for that .

Vodolazkyi commented 7 years ago

Try solution in https://github.com/Yalantis/FoldingTabBar.iOS/issues/78