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:
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..
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).