Can we add more than five tab bars in ios sdk?

I want to add the 6th tab bar to my project. When I try to do this, I have more options, but when I click on more tabs, nothing happens. Provide me with a good solution on this, as well as any other logic.

+3
source share
4 answers

iOS 9 (, , 8), . - 4 5, - .

, iPad , , "".

Apple " "? .

, UITabBarController :

-(UITraitCollection *)traitCollection
{
  UITraitCollection
  *realTraits = [super traitCollection],
  *lieTrait = [UITraitCollection traitCollectionWithHorizontalSizeClass:UIUserInterfaceSizeClassRegular];
  return [UITraitCollection traitCollectionWithTraitsFromCollections:@[realTraits, lieTrait]];
}

, ! , Apple , !

(* , . , - setOverrideTraitCollection:forChildViewController: , , setViewControllers:, "" . , .)

+6

In the fast, subclass UITabBarControllerand implement:

override var traitCollection: UITraitCollection {
    let realTraits = super.traitCollection
    let lieTrait = UITraitCollection.init(horizontalSizeClass: .regular)
    return UITraitCollection(traitsFrom: [realTraits, lieTrait])
}
+5
source

Make CustomTabBarVC inherited from UITabBarController and run it to make it possible for you.

import UIKit

class CustomTabBarVC: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()

    }

    override var traitCollection: UITraitCollection {
        let realTraits = super.traitCollection
        let fakeTraits = UITraitCollection(horizontalSizeClass: .regular)
        return UITraitCollection(traitsFrom: [realTraits, fakeTraits])
    }
}

enter image description here

0
source

All Articles