1

How can i achieve like this enter image description here

in UITableView controller not in UIViewController.

here i'm using SAP Fiori component for design.

So far i tried ui form storybard using navigation bar prompt:enter image description here

here is the code so far i tried:

      self.navigationController?.makeBlackNavigationbar()
        self.navigationController?.navigationBar.makeBlackNavigationBar()
        let items = ["Label A", "Label B"]
        segmentedController = UISegmentedControl(items: items)
        segmentedController.frame = (self.navigationController?.toolbar.bounds)!
        self.navigationController?.toolbar.addSubview(segmentedController)

     extension UINavigationController
     {
      func makeBlackNavigationbar (){

        print("black navigation")

        navigationController?.isNavigationBarHidden = false
      }
    }

    extension UINavigationBar
    { 

      func makeBlackNavigationBar ()
      {
        barTintColor = UIColor(red: 68/255, green: 94/255, blue: 117/255, alpha: 1)
        let titleDict: NSDictionary = [NSAttributedStringKey.foregroundColor: UIColor.white]
        titleTextAttributes = titleDict as [NSObject : AnyObject] as! [NSAttributedStringKey : Any]



       }
     }

Any help much appreciated pls..

Boghyon Hoffmann
  • 17,103
  • 12
  • 72
  • 170
PvUIDev
  • 95
  • 1
  • 9
  • 38
  • see this for help : [UISegmentedControl below UINavigationbar in iOS 7](https://stackoverflow.com/questions/21887252/uisegmentedcontrol-below-uinavigationbar-in-ios-7/21999916) – Anbu.Karthik Aug 13 '19 at 10:09
  • @Anbu.Karthik can u check my tried screenshot.. – PvUIDev Aug 13 '19 at 10:14

1 Answers1

0

How can i achieve like this

You can't. You can have the segmented control as the title view, replacing the title text; but you cannot have both a segmented control as the title view and title text.

The only way to get something like the first screenshot would be through an elaborate illusion. You'd need to have the segmented control outside the navigation bar, as part of the main view, but surrounded by a view that looks like the navigation bar and melds into it (because the navigation bar itself has no visible bottom edge or shadow).

matt
  • 515,959
  • 87
  • 875
  • 1,141