Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

swift add navigation bar

override func viewDidLoad() {
    super.viewDidLoad()
    self.setNavigationBar()
}

func setNavigationBar() {
        let screenSize: CGRect = UIScreen.main.bounds
        let navBar = UINavigationBar(frame: CGRect(x: 0, y: 0, width: screenSize.width, height: 44))
        let navItem = UINavigationItem(title: "")
        let doneItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonItem.SystemItem.done, target: nil, action: #selector(dissmissView))
        navItem.rightBarButtonItem = doneItem
        navBar.setItems([navItem], animated: false)
        self.view.addSubview(navBar)
    }

@objc
    func dissmissView(){
        self.dismiss(animated: true, completion: nil)
    }
Comment

add navigation bar button swiftui

.navigationBarItems(
    leading: Button(action: {
        // Actions
    }, label: { Text("Button") }),

    trailing: Button(action: {
    // Actions
    }, label: { Image("Icon") })
)
Comment

swift add navigation bar

let navBar = UINavigationBar(frame: CGRect(x: 0, y: 0, width: view.frame.size.width, height: 44))
view.addSubview(navBar)

let navItem = UINavigationItem(title: "SomeTitle")
let doneItem = UIBarButtonItem(barButtonSystemItem: .done, target: nil, action: #selector(selectorName:))
navItem.rightBarButtonItem = doneItem

navBar.setItems([navItem], animated: false)
Comment

PREVIOUS NEXT
Code Example
Swift :: change image tint color swiftui 
Swift :: swiftui create search bar 
Swift :: uibutton swift set title color 
Swift :: enviroment dissmiss swiftui 
Swift :: swift simulatore condition 
Swift :: swift 5 get first character of string 
Swift :: collectionview cellssize swift 4 
Swift :: swiftui coin flip 
Swift :: average in array swift 
Swift :: swiftui font add 
Swift :: uilabel set fon siz 
Swift :: Swift Calling a function in Swift 
Swift :: Play Video in AVPlayer Sample Code Swift 
Swift :: swift check if regex is in string 
Swift :: Swift Loop Over Array 
Swift :: swift uilabel font bold 
Swift :: two integer value sum in swift 
Swift :: Swift Named Associated Values 
Swift :: Swift for Loop with where Clause 
Swift :: Swift n Parameter with Default Values 
Swift :: int in swift 
Swift :: Swift for vs while loop 
Swift :: swift check if class is of type 
Swift :: Swift Things to Remember About Swift Range 
Swift :: selenium lfor loops 
Swift :: key path expression as functions ios swift 
Swift :: mp3 player with swift iOS & macOS 
Swift :: swift variable 
Ruby :: ruby array group by attribute 
Ruby :: run rake task in rails console 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =